-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
4 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"repository": "https://github.com/TrialAndErrorOrg/parsers", | ||
"author": "Thomas F. K. Jorna <[email protected]>", | ||
"type": "module", | ||
"description": "Reads a `.docx` file and stores its components in vfile format to be processed by other tools, like [`reoff-parse`](https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-parse).", | ||
"description": "Reads a `.docx` file and stores its components in vfile format to be processed by other tools, like `reoff-parse`.", | ||
"keywords": [ | ||
"unified", | ||
"docx", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1 @@ | ||
// import type { ReadStream } from 'fs' | ||
// import { VFile } from 'vfile' | ||
// import { docxToVFile as docxToVFileBrowser, Options } from './lib/docx-to-vfile-unzipit.js' | ||
|
||
// /** | ||
// * Takes a docx file as a Blob, Buffer, ArrayBuffer, ReadStream or string | ||
// * and returns a VFile with the contents of the document.xml file as the root, and the contents of the other xml files as data. | ||
// * | ||
// * Should work in both Node and the browser, but to be sure it works in the browser, import it like | ||
// * ```ts | ||
// * import { docxToVFile } from 'docx-to-vfile/browser' | ||
// * ``` | ||
// * | ||
// * @param file The docx file as a File, Blob, Buffer, ArrayBuffer, ReadStream or string | ||
// * @param options Options | ||
// * @returns A VFile with the contents of the document.xml file as the root, and the contents of the other xml files as data. | ||
// */ | ||
// export async function docxToVFile( | ||
// file: ArrayBuffer | File | Blob | Buffer | ReadStream | string, | ||
// options?: Options, | ||
// ): Promise<VFile> { | ||
// if (typeof window !== 'undefined') { | ||
// return await docxToVFileBrowser(file as Blob, options) | ||
// } | ||
|
||
// const { createReadStream, ReadStream } = await import('fs') | ||
// const { blob } = await import('stream/consumers') | ||
// const { Blob: NodeBlob } = await import('buffer') | ||
|
||
// const inp = typeof file === 'string' ? createReadStream(file) : file | ||
|
||
// const input = | ||
// inp instanceof ReadStream | ||
// ? await blob(inp) | ||
// : inp instanceof ArrayBuffer | ||
// ? new NodeBlob([Buffer.from(inp)]) | ||
// : inp | ||
|
||
// return await docxToVFileBrowser(input as Blob | File, options) | ||
// } | ||
|
||
export * from './lib/docx-to-vfile-unzipit.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters