|
1 | | -import type { ExtractorConfig } from './types'; |
| 1 | +import type { PartialExtractorConfig } from './types'; |
2 | 2 | import { parseConfig } from './config'; |
3 | 3 | import { getExtractor } from './extractors.registry'; |
4 | 4 |
|
5 | | -export async function extractText({ arrayBuffer, mimeType, config: rawConfig }: { arrayBuffer: ArrayBuffer; mimeType: string; config?: ExtractorConfig }): Promise<{ |
| 5 | +export async function extractText({ arrayBuffer, mimeType, config: rawConfig }: { arrayBuffer: ArrayBuffer; mimeType: string; config?: PartialExtractorConfig }): Promise<{ |
6 | 6 | extractorName: string | undefined; |
7 | 7 | textContent: string | undefined; |
8 | 8 | error?: Error; |
@@ -33,13 +33,13 @@ export async function extractText({ arrayBuffer, mimeType, config: rawConfig }: |
33 | 33 | } |
34 | 34 | } |
35 | 35 |
|
36 | | -export async function extractTextFromBlob({ blob }: { blob: Blob }) { |
| 36 | +export async function extractTextFromBlob({ blob, config }: { blob: Blob; config?: PartialExtractorConfig }) { |
37 | 37 | const arrayBuffer = await blob.arrayBuffer(); |
38 | 38 | const mimeType = blob.type; |
39 | 39 |
|
40 | | - return extractText({ arrayBuffer, mimeType }); |
| 40 | + return extractText({ arrayBuffer, mimeType, config }); |
41 | 41 | } |
42 | 42 |
|
43 | | -export async function extractTextFromFile({ file }: { file: File }) { |
44 | | - return extractTextFromBlob({ blob: file }); |
| 43 | +export async function extractTextFromFile({ file, config }: { file: File; config?: PartialExtractorConfig }) { |
| 44 | + return extractTextFromBlob({ blob: file, config }); |
45 | 45 | } |
0 commit comments