UNPKG

@langchain/community

Version:
1 lines • 2.16 kB
{"version":3,"file":"docx.d.ts","names":["Document","BufferLoader","DocxLoaderOptions","DocxLoader","Blob","Buffer","Promise"],"sources":["../../../src/document_loaders/fs/docx.d.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\nimport { BufferLoader } from \"@langchain/classic/document_loaders/fs/buffer\";\ntype DocxLoaderOptions = {\n type: \"docx\" | \"doc\";\n};\n/**\n * A class that extends the `BufferLoader` class. It represents a document\n * loader that loads documents from DOCX files.\n * It has a constructor that takes a `filePathOrBlob` parameter representing the path to the word\n * file or a Blob object, and an optional `options` parameter of type\n * `DocxLoaderOptions`\n */\nexport declare class DocxLoader extends BufferLoader {\n protected options: DocxLoaderOptions;\n constructor(filePathOrBlob: string | Blob, options?: DocxLoaderOptions);\n /**\n * A method that takes a `raw` buffer and `metadata` as parameters and\n * returns a promise that resolves to an array of `Document` instances. It\n * uses the `extractRawText` function from the `mammoth` module or\n * `extract` method from the `word-extractor` module to extract\n * the raw text content from the buffer. If the extracted text content is\n * empty, it returns an empty array. Otherwise, it creates a new\n * `Document` instance with the extracted text content and the provided\n * metadata, and returns it as an array.\n * @param raw The raw buffer from which to extract text content.\n * @param metadata The metadata to be associated with the created `Document` instance.\n * @returns A promise that resolves to an array of `Document` instances.\n */\n parse(raw: Buffer, metadata: Document[\"metadata\"]): Promise<Document[]>;\n private parseDocx;\n private parseDoc;\n}\nexport {};\n//# sourceMappingURL=docx.d.ts.map"],"mappings":";;;;KAEKE,iBAAAA;;AADwE,CAAA;AAW7E;;;;;;;AAgBwDI,cAhBnCH,UAAAA,SAAmBF,YAAAA,CAgBgBK;EAhBhBL,UAAAA,OAAAA,EACjBC,iBADiBD;EAAY,WAAA,CAAA,cAAA,EAAA,MAAA,GAEXG,IAFW,EAAA,OAAA,CAAA,EAEKF,iBAFL;;;;;;;;;;;;;;aAgBrCG,kBAAkBL,uBAAuBM,QAAQN"}