{"id":18961644,"url":"https://github.com/trialanderrororg/docx-to-vfile","last_synced_at":"2025-04-19T11:41:44.085Z","repository":{"id":130692374,"uuid":"607887690","full_name":"TrialAndErrorOrg/docx-to-vfile","owner":"TrialAndErrorOrg","description":"Reads a `.docx` file and stores its components in vfile format to be processed by other tools, like `reoff-parse`.","archived":false,"fork":false,"pushed_at":"2024-06-28T18:53:44.000Z","size":598,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T07:22:44.440Z","etag":null,"topics":["docx","office","ooxast","ooxml","unified","vfile","word"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TrialAndErrorOrg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/funding.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"tefkah"}},"created_at":"2023-02-28T21:57:19.000Z","updated_at":"2024-12-15T00:46:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"64e3702c-3eb1-4e84-a71a-f07be6a23b8d","html_url":"https://github.com/TrialAndErrorOrg/docx-to-vfile","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fdocx-to-vfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fdocx-to-vfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fdocx-to-vfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrialAndErrorOrg%2Fdocx-to-vfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TrialAndErrorOrg","download_url":"https://codeload.github.com/TrialAndErrorOrg/docx-to-vfile/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249195412,"owners_count":21228193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docx","office","ooxast","ooxml","unified","vfile","word"],"created_at":"2024-11-08T14:13:50.435Z","updated_at":"2025-04-16T04:32:54.409Z","avatar_url":"https://github.com/TrialAndErrorOrg.png","language":"TypeScript","funding_links":["https://github.com/sponsors/tefkah"],"categories":[],"sub_categories":[],"readme":"\u003e **Note**\n\u003e This repository is automatically generated from the [main parser monorepo](https://github.com/TrialAndErrorOrg/parsers). Please submit any issues or pull requests there.\n\n# docx-to-vfile\n\n[![npm version](https://badge.fury.io/js/docx-to-vfile.svg)](https://badge.fury.io/js/docx-to-vfile) [![npm downloads](https://img.shields.io/npm/dm/docx-to-vfile.svg)](https://www.npmjs.com/package/docx-to-vfile)\n\nReads 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).\n\nCurrently extremely dumb and just stores it all in memory, no streams for you.\nFile reading does happen in streams.\n\nBased on [docxtract](https://github.com/sorleone/doxtract/)\n\n## Contents\n\n- [docx-to-vfile](#docx-to-vfile)\n  - [Contents](#contents)\n  - [What is this?](#what-is-this)\n  - [When should I use this?](#when-should-i-use-this)\n  - [Install](#install)\n  - [Use](#use)\n    - [In Node](#in-node)\n    - [In the browser](#in-the-browser)\n    - [Output](#output)\n  - [API](#api)\n    - [`docxToVFile()`](#docxtovfile)\n      - [Signature](#signature)\n      - [Parameters](#parameters)\n      - [Returns](#returns)\n    - [`DocxData`](#docxdata)\n      - [Hierarchy](#hierarchy)\n      - [Indexable](#indexable)\n      - [Properties](#properties)\n        - [`media`](#media)\n          - [Index signature](#index-signature)\n          - [Type declaration](#type-declaration)\n        - [`relations`](#relations)\n          - [Index signature](#index-signature-1)\n          - [Type declaration](#type-declaration-1)\n    - [`DocxVFile`](#docxvfile)\n      - [Hierarchy](#hierarchy-1)\n      - [Properties](#properties-1)\n        - [`cwd`](#cwd)\n        - [`data`](#data)\n        - [`history`](#history)\n        - [`map`](#map)\n        - [`messages`](#messages)\n        - [`result`](#result)\n        - [`stored`](#stored)\n        - [`value`](#value)\n      - [Accessors](#accessors)\n        - [`basename`](#basename)\n          - [Signature](#signature-1)\n          - [Returns](#returns-1)\n          - [Signature](#signature-2)\n          - [Parameters](#parameters-1)\n          - [Returns](#returns-2)\n        - [`dirname`](#dirname)\n          - [Signature](#signature-3)\n          - [Returns](#returns-3)\n          - [Signature](#signature-4)\n          - [Parameters](#parameters-2)\n          - [Returns](#returns-4)\n        - [`extname`](#extname)\n          - [Signature](#signature-5)\n          - [Returns](#returns-5)\n          - [Signature](#signature-6)\n          - [Parameters](#parameters-3)\n          - [Returns](#returns-6)\n        - [`path`](#path)\n          - [Signature](#signature-7)\n          - [Returns](#returns-7)\n          - [Signature](#signature-8)\n          - [Parameters](#parameters-4)\n          - [Returns](#returns-8)\n        - [`stem`](#stem)\n          - [Signature](#signature-9)\n          - [Returns](#returns-9)\n          - [Signature](#signature-10)\n          - [Parameters](#parameters-5)\n          - [Returns](#returns-10)\n      - [Methods](#methods)\n        - [`fail()`](#fail)\n          - [Throws](#throws)\n          - [Signature](#signature-11)\n          - [Parameters](#parameters-6)\n          - [Returns](#returns-11)\n        - [`info()`](#info)\n          - [Signature](#signature-12)\n          - [Parameters](#parameters-7)\n          - [Returns](#returns-12)\n        - [`message()`](#message)\n          - [Signature](#signature-13)\n          - [Parameters](#parameters-8)\n          - [Returns](#returns-13)\n        - [`toString()`](#tostring)\n          - [Signature](#signature-14)\n          - [Parameters](#parameters-9)\n          - [Returns](#returns-14)\n    - [`Options`](#options)\n      - [Properties](#properties-2)\n        - [`include?`](#include)\n          - [Default](#default)\n        - [`withoutMedia?`](#withoutmedia)\n          - [Default](#default-1)\n    - [`XMLOrRelsString`](#xmlorrelsstring)\n  - [Compatibility](#compatibility)\n  - [Security](#security)\n  - [Related](#related)\n  - [Contribute](#contribute)\n  - [License](#license)\n\n## What is this?\n\nThis package reads a `.docx` file and stores its components in vfile format to be processed by other tools, like [`reoff-parse`][reoff-parse]. This is the first step in a pipeline to convert a `.docx` file to many other formats using the `unified` ecosystem.\n\nA `.docx` document is just a zip file with a bunch of XML and other files (such as images) in it. This package unzips the `.docx` file, reads the XML files and images and stores them in a `VFile` object, which is a virtual file format that can be used by other tools in the `unified` ecosystem.\n\n## When should I use this?\n\nProbably only exclusively to read a `docx` file to feed into `reoff-parse` or something similar, or if you want to access the raw data of a `docx` file for some reason.\n\n## Install\n\nThis package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install as\n\n```bash\npnpm add docx-to-vfile\n# or with yarn\n# yarn add docx-to-vfile\n# or with npm\n# npm install docx-to-vfile\n```\n\n## Use\n\n### In Node\n\n```ts\nimport { docxToVFile } from 'docx-to-vfile'\n```\n\nPass a path to a `.docx` file\n\n```ts\nconst file = await docxToVFile('path/to/file.docx')\n```\n\nPass a `Blob`\n\n```ts\nconst blob = await fetch('https://path/to/file.docx').then((res) =\u003e res.blob())\nconst file = await docxToVFile(blob)\n```\n\nPass a `Buffer`\n\n```ts\nimport { readFile } from 'fs/promises'\nconst buffer = await readFile('path/to/file.docx')\nconst file = await docxToVFile(buffer)\n```\n\nPass a `ReadStream`\n\n```ts\nimport { createReadStream } from 'fs'\n\nconst file = await docxToVFile(createReadStream('path/to/file.docx'))\n```\n\n### In the browser\n\n```ts\nimport { docxToVFile } from 'docx-to-vfile/browser'\n```\n\nPass a `File`\n\n```html\n\u003cinput type=\"file\" /\u003e\n```\n\n```ts\ndocument.querySelector('input[type=\"file\"]')?.addEventListener('change', async (e) =\u003e {\n  const file = await docxToVFile(e.target.files[0])\n})\n```\n\n### Output\n\nUsing the default settings, the main value of the VFile will be the content of the main document, and the data will contain the content of the other files in the .docx archive. Media files will be stored in the media property.\n\n```ts\nconst output = {\n  data: {\n    'word/footnotes.xml': '\u003c?xml version ...',\n    '_rels/rels': '\u003c?xml version ...',\n    // ...\n    relations: {\n      rId9: 'footnotes.xml',\n      rId8: 'endnotes.xml',\n      // ...\n    },\n    media: {\n      media/image1.png: //\u003cBlob\u003e,\n    },\n  },\n  value: //'[the content of word/document.xml, the main document]',\n  // other vfile stuff\n  messages: [],\n  history: [],\n  cwd: './',\n}\n\nString(output) === output.value // true\n```\n\n## API\n\n---\n\n### `docxToVFile()`\n\nTakes a docx file as an ArrayBuffer 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.\n\n#### Signature\n\n```ts\ndocxToVFile(file: ArrayBuffer, userOptions: Options = {}): Promise\u003cVFile\u003e;\n```\n\n#### Parameters\n\n| Name          | Type                            | Description                     |\n| :------------ | :------------------------------ | :------------------------------ |\n| `file`        | `ArrayBuffer`                   | The docx file as an ArrayBuffer |\n| `userOptions` | [`Options`](modules.md#options) | -                               |\n\n#### Returns\n\n`Promise`\u003c`VFile`\u003e\n\nA VFile with the contents of the document.xml file as the root, and the contents of the other xml files as data.\n\nDefined in: [src/lib/docx-to-vfile-unzipit.ts:90](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L90)\n\n---\n\n### `DocxData`\n\nThe data attribute of a VFile\nIs set to the DataMap interface in the vfile module\n\n#### Hierarchy\n\n- `Data`.**DocxData**\n\n#### Indexable\n\n[`key`: [`XMLOrRelsString`](modules.md#xmlorrelsstring)]: `string` | `undefined`\n\n#### Properties\n\n##### `media`\n\n\u003e `object`\n\nThe media files in the .docx file\n\n###### Index signature\n\n[`key`: `string`]: `ArrayBuffer`\n\n###### Type declaration\n\nOverrides: Data.media\n\nDefined in: [src/lib/docx-to-vfile-unzipit.ts:45](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L45)\n\n##### `relations`\n\n\u003e `object`\n\nThe relations between the .xml files in the .docx file\n\n###### Index signature\n\n[`key`: `string`]: `string`\n\n###### Type declaration\n\nOverrides: Data.relations\n\nDefined in: [src/lib/docx-to-vfile-unzipit.ts:49](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L49)\n\n---\n\n### `DocxVFile`\n\nExtends VFile with a custom data attribute\n\nThis information should be on the VFile interface, this is just used in contexts where you only want to know the type of the data attribute,\ne.g. when writing a library that does something with the output of `docxToVFile`.\n\n#### Hierarchy\n\n- `VFile`.**DocxVFile**\n\n#### Properties\n\n##### `cwd`\n\n\u003e `string`\n\nBase of `path` (default: `process.cwd()` or `'/'` in browsers).\n\nInherited from: VFile.cwd\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:53\n\n##### `data`\n\n\u003e [`DocxData`](modules.md#docxdata)\n\nOverrides: VFile.data\n\nDefined in: [src/lib/docx-to-vfile-unzipit.ts:80](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L80)\n\n##### `history`\n\n\u003e `string`[]\n\nList of filepaths the file moved between.\n\nThe first is the original path and the last is the current path.\n\nInherited from: VFile.history\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:47\n\n##### `map`\n\n\u003e `undefined` | `null` | `Map`\n\nSource map.\n\nThis type is equivalent to the `RawSourceMap` type from the `source-map`\nmodule.\n\nInherited from: VFile.map\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:85\n\n##### `messages`\n\n\u003e `VFileMessage`[]\n\nList of messages associated with the file.\n\nInherited from: VFile.messages\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:39\n\n##### `result`\n\n\u003e `unknown`\n\nCustom, non-string, compiled, representation.\n\nThis is used by unified to store non-string results.\nOne example is when turning markdown into React nodes.\n\nInherited from: VFile.result\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:76\n\n##### `stored`\n\n\u003e `boolean`\n\nWhether a file was saved to disk.\n\nThis is used by vfile reporters.\n\nInherited from: VFile.stored\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:67\n\n##### `value`\n\n\u003e `Value`\n\nRaw value.\n\nInherited from: VFile.value\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:59\n\n#### Accessors\n\n##### `basename`\n\nGet the basename (including extname) (example: `'index.min.js'`).\n\n###### Signature\n\n```ts\nbasename(): undefined | string;\n```\n\n###### Returns\n\n`undefined` | `string`\n\nInherited from: VFile.basename\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:123\n\nSet basename (including extname) (`'index.min.js'`).\n\nCannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\non windows).\nCannot be nullified (use `file.path = file.dirname` instead).\n\n###### Signature\n\n```ts\nbasename(arg: undefined | string): void;\n```\n\n###### Parameters\n\n| Name  | Type        |\n| :---- | :---------- | -------- |\n| `arg` | `undefined` | `string` |\n\n###### Returns\n\n`void`\n\nInherited from: VFile.basename\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:119\n\nInherited from: VFile.basename\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:119 node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:123\n\n##### `dirname`\n\nGet the parent path (example: `'~'`).\n\n###### Signature\n\n```ts\ndirname(): undefined | string;\n```\n\n###### Returns\n\n`undefined` | `string`\n\nInherited from: VFile.dirname\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:111\n\nSet the parent path (example: `'~'`).\n\nCannot be set if there’s no `path` yet.\n\n###### Signature\n\n```ts\ndirname(arg: undefined | string): void;\n```\n\n###### Parameters\n\n| Name  | Type        |\n| :---- | :---------- | -------- |\n| `arg` | `undefined` | `string` |\n\n###### Returns\n\n`void`\n\nInherited from: VFile.dirname\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:107\n\nInherited from: VFile.dirname\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:107 node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:111\n\n##### `extname`\n\nGet the extname (including dot) (example: `'.js'`).\n\n###### Signature\n\n```ts\nextname(): undefined | string;\n```\n\n###### Returns\n\n`undefined` | `string`\n\nInherited from: VFile.extname\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:135\n\nSet the extname (including dot) (example: `'.js'`).\n\nCannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\non windows).\nCannot be set if there’s no `path` yet.\n\n###### Signature\n\n```ts\nextname(arg: undefined | string): void;\n```\n\n###### Parameters\n\n| Name  | Type        |\n| :---- | :---------- | -------- |\n| `arg` | `undefined` | `string` |\n\n###### Returns\n\n`void`\n\nInherited from: VFile.extname\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:131\n\nInherited from: VFile.extname\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:131 node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:135\n\n##### `path`\n\nGet the full path (example: `'~/index.min.js'`).\n\n###### Signature\n\n```ts\npath(): string;\n```\n\n###### Returns\n\n`string`\n\nInherited from: VFile.path\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:101\n\nSet the full path (example: `'~/index.min.js'`).\n\nCannot be nullified.\nYou can set a file URL (a `URL` object with a `file:` protocol) which will\nbe turned into a path with `url.fileURLToPath`.\n\n###### Signature\n\n```ts\npath(arg: string): void;\n```\n\n###### Parameters\n\n| Name  | Type     |\n| :---- | :------- |\n| `arg` | `string` |\n\n###### Returns\n\n`void`\n\nInherited from: VFile.path\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:95\n\nInherited from: VFile.path\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:95 node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:101\n\n##### `stem`\n\nGet the stem (basename w/o extname) (example: `'index.min'`).\n\n###### Signature\n\n```ts\nstem(): undefined | string;\n```\n\n###### Returns\n\n`undefined` | `string`\n\nInherited from: VFile.stem\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:147\n\nSet the stem (basename w/o extname) (example: `'index.min'`).\n\nCannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\non windows).\nCannot be nullified (use `file.path = file.dirname` instead).\n\n###### Signature\n\n```ts\nstem(arg: undefined | string): void;\n```\n\n###### Parameters\n\n| Name  | Type        |\n| :---- | :---------- | -------- |\n| `arg` | `undefined` | `string` |\n\n###### Returns\n\n`void`\n\nInherited from: VFile.stem\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:143\n\nInherited from: VFile.stem\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:143 node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:147\n\n#### Methods\n\n##### `fail()`\n\nCreate a fatal error associated with the file.\n\nIts `fatal` is set to `true` and `file` is set to the current file path.\nIts added to `file.messages`.\n\n\u003e 👉 **Note**: a fatal error means that a file is no longer processable.\n\n###### Throws\n\nMessage.\n\n###### Signature\n\n```ts\nfail(reason: string | VFileMessage | Error, place?: null | Node\u003cData\u003e | NodeLike | Position | Point, origin?: null | string): never;\n```\n\n###### Parameters\n\n| Name      | Type     | Description    |\n| :-------- | :------- | :------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------- | ----------------------------------------- |\n| `reason`  | `string` | `VFileMessage` | `Error`                                                                                      | Reason for message, uses the stack and message of the error if given. |\n| `place?`  | `null`   | `Node`\u003c`Data`\u003e | `NodeLike`                                                                                   | `Position`                                                            | `Point` | Place in file where the message occurred. |\n| `origin?` | `null`   | `string`       | Place in code where the message originates (example: `'my-package:my-rule'` or `'my-rule'`). |\n\n###### Returns\n\n`never`\n\nMessage.\n\nInherited from: VFile.fail\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:220\n\n##### `info()`\n\nCreate an info message associated with the file.\n\nIts `fatal` is set to `null` and `file` is set to the current file path.\nIts added to `file.messages`.\n\n###### Signature\n\n```ts\ninfo(reason: string | VFileMessage | Error, place?: null | Node\u003cData\u003e | NodeLike | Position | Point, origin?: null | string): VFileMessage;\n```\n\n###### Parameters\n\n| Name      | Type     | Description    |\n| :-------- | :------- | :------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------- | ----------------------------------------- |\n| `reason`  | `string` | `VFileMessage` | `Error`                                                                                      | Reason for message, uses the stack and message of the error if given. |\n| `place?`  | `null`   | `Node`\u003c`Data`\u003e | `NodeLike`                                                                                   | `Position`                                                            | `Point` | Place in file where the message occurred. |\n| `origin?` | `null`   | `string`       | Place in code where the message originates (example: `'my-package:my-rule'` or `'my-rule'`). |\n\n###### Returns\n\n`VFileMessage`\n\nMessage.\n\nInherited from: VFile.info\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:195\n\n##### `message()`\n\nCreate a warning message associated with the file.\n\nIts `fatal` is set to `false` and `file` is set to the current file path.\nIts added to `file.messages`.\n\n###### Signature\n\n```ts\nmessage(reason: string | VFileMessage | Error, place?: null | Node\u003cData\u003e | NodeLike | Position | Point, origin?: null | string): VFileMessage;\n```\n\n###### Parameters\n\n| Name      | Type     | Description    |\n| :-------- | :------- | :------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------- | ----------------------------------------- |\n| `reason`  | `string` | `VFileMessage` | `Error`                                                                                      | Reason for message, uses the stack and message of the error if given. |\n| `place?`  | `null`   | `Node`\u003c`Data`\u003e | `NodeLike`                                                                                   | `Position`                                                            | `Point` | Place in file where the message occurred. |\n| `origin?` | `null`   | `string`       | Place in code where the message originates (example: `'my-package:my-rule'` or `'my-rule'`). |\n\n###### Returns\n\n`VFileMessage`\n\nMessage.\n\nInherited from: VFile.message\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:174\n\n##### `toString()`\n\nSerialize the file.\n\n###### Signature\n\n```ts\ntoString(encoding?: null | BufferEncoding): string;\n```\n\n###### Parameters\n\n| Name        | Type   | Description      |\n| :---------- | :----- | :--------------- | ------------------------------------------------------------------------------------- |\n| `encoding?` | `null` | `BufferEncoding` | Character encoding to understand `value` as when it’s a `Buffer` (default: `'utf8'`). |\n\n###### Returns\n\n`string`\n\nSerialized file.\n\nInherited from: VFile.toString\n\nDefined in: node_modules/.pnpm/vfile\\@5.3.7/node_modules/vfile/lib/index.d.ts:157\n\n---\n\n### `Options`\n\n#### Properties\n\n##### `include?`\n\n\u003e `string`[] | `RegExp`[] | (`key`: `string`) =\u003e `boolean` | `\"all\"` | `\"allWithDocumentXML\"`\n\nInclude only the specified files on the `data` attribute of the VFile.\nThis may be useful if you want to only do something with a subset of the files in the docx file, and don't intend to use 'reoff-stringify' to turn the VFile back into a docx file.\n\n- If an array of strings or regexps is passed, only files that match one of the values will be included.\n- If a function is passed, it will be called for each file and should return true to include the file.\n- If the value is 'all', almost all files will be included, except for 'word/document.xml', as that already is the root of the VFile.\n- If the value is 'allWithDocumentXML', all files will be included, including `word/document.xml`, even though that is already the root of the VFile. Useful if you really want to mimic the original docx file.\n\nYou should keep it at the default value if you intend to use 'reoff-stringify' to turn the VFile back into a docx file.\n\n###### Default\n\n'all'\n\nDefined in: [src/lib/docx-to-vfile-unzipit.ts:30](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L30)\n\n##### `withoutMedia?`\n\n\u003e `boolean`\n\nWhether or not to include media in the VFile.\n\nBy default, images are included on the `data.media` attribute of the VFile as an object of ArrayBuffers, which are accessible both client and serverside.\n\n###### Default\n\nfalse\n\nDefined in: [src/lib/docx-to-vfile-unzipit.ts:16](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L16)\n\n---\n\n### `XMLOrRelsString`\n\n\u003e `${string}.xml` | `${string}.rels`\n\nDefined in: [src/lib/docx-to-vfile-unzipit.ts:71](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L71)\n\n## Compatibility\n\n## Security\n\n`docx-to-vfile` currently does not read macros, so it is not vulnerable to potential security issues with macros.\n\nIt does not however do any other security checks, so it is possible that maliciously crafted docx files could cause problems when e.g. parsed with `rehype`.\n\n## Related\n\n- [`reoff-parse`][reoff-parse] — Parse the output of `docx-to-vfile` into a `VFile` with an `ooxast` tree.\n\n## Contribute\n\n## License\n\n[GPL-3.0-or-later](LICENSE) © Thomas F. K. Jorna\n\n[unified]: https://unifiedjs.com\n[unifiedgh]: https://github.com/unifiedjs/unified\n[xast-from-xml]: https://github.com/syntax-tree/xast-util-from-xml\n[rehype]: https://github.com/rehypejs/rehype\n[rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour\n[rejour-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-parse\n[rejour-stringify]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-stringify\n[rejour-move-abstract]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-move-abstract\n[rejour-meta]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-meta\n[rejour-relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-relatex\n[relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex\n[reoff-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/reoff-parse\n[jast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast\n[jast-util-to-texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast-util-to-texast\n[jastscript]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jastscript\n[texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast\n[texast-util-to-latex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast-util-to-latex\n[hast]: https://github.com/syntax-tree/hast\n[xast]: https://github.com/syntax-tree/xast\n[mdast]: https://github.com/syntax-tree/mdast\n[mdast-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n[latex-utensils]: https://github.com/tamuratak/latex-utensils\n[latexjs]: https://github.com/latexjs/latexjs\n[reoff]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff\n[reoff-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-parse\n[reoff-rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-rejour\n[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast\n[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast-util-to-jast\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrialanderrororg%2Fdocx-to-vfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrialanderrororg%2Fdocx-to-vfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrialanderrororg%2Fdocx-to-vfile/lists"}