$ npm install extract-files
A function to recursively extract files and their object paths within a value, replacing them with null
in a deep clone without mutating the original value. FileList
instances are treated as File
instance arrays. Files are typically File
and Blob
instances.
Used by GraphQL multipart request spec client implementations such as graphql-react
and apollo-upload-client
.
For Node.js, to install extract-files
with npm, run:
npm install extract-files
For Deno and browsers, an example import map:
{
"imports": {
"extract-files/": "https://unpkg.com/extract-files@13.0.0/",
"is-plain-obj": "https://unpkg.com/is-plain-obj@4.1.0/index.js",
"is-plain-obj/": "https://unpkg.com/is-plain-obj@4.1.0/"
}
}
See the function extractFiles
to get started.
Supported runtime environments:
^14.17.0 || ^16.0.0 || >= 18.0.0
.> 0.5%, not OperaMini all, not dead
.Non Deno projects must configure TypeScript to use types from the ECMAScript modules that have a // @ts-check
comment:
compilerOptions.allowJs
should be true
.compilerOptions.maxNodeModuleJsDepth
should be reasonably large, e.g. 10
.compilerOptions.module
should be "node16"
or "nodenext"
.The npm package extract-files
features optimal JavaScript module design. It doesn’t have a main index module, so use deep imports from the ECMAScript modules that are exported via the package.json
field exports
:
© 2010 - cnpmjs.org x YWFE | Home | YWFE