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 instance

MIT 21 个版本
安装
npm install extract-files
yarn add extract-files
pnpm add extract-files
bun add extract-files
README

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.

Installation

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.

Requirements

Supported runtime environments:

Non Deno projects must configure TypeScript to use types from the ECMAScript modules that have a // @ts-check comment:

Exports

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:

版本列表
13.0.0 2022-08-29
12.0.0 2022-01-14
11.0.0 2021-06-11
10.0.0 2021-05-10
9.0.0 2020-07-22
8.1.0 2020-04-07
8.0.0 2020-03-24
7.0.0 2020-01-03
6.0.0 2019-12-05
5.0.1 2019-01-21
5.0.0 2018-12-20
4.1.0 2018-11-01
4.0.0 2018-08-13
3.1.0 2018-01-28
3.0.0 2018-01-17
2.1.1 2018-01-15
2.1.0 2018-01-15
2.0.1 2017-08-09
2.0.0 2017-07-26
1.1.0 2017-07-13
1.0.0 2017-07-12