# 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

Latest version **14.0.0** (published 2026-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install extract-files
pnpm add extract-files
yarn add extract-files
bun add extract-files
```

## Health

**Score 63/100 (C)** — status: active.

Positive: has types package; esm support; no vulnerabilities; recently updated; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 14.0.0 |
| Published | 2026-07-24 |
| First published | 2017-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/extract-files) |
| Module format | ESM + CommonJS |
| Node | ^22.13.0 \|\| ^24.0.0 \|\| >=26.0.0 |
| Dependencies | 1 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 57 |
| Author | Jayden Seric |
| Maintainers | jaydenseric |
| Keywords | extract, file, files, File, FileList, Blob, esm, mjs |

## Links

- npm: https://www.npmjs.com/package/extract-files
- Repository: https://github.com/jaydenseric/extract-files
- Homepage: https://github.com/jaydenseric/extract-files#readme
- Issues: https://github.com/jaydenseric/extract-files/issues
- Funding: https://github.com/sponsors/jaydenseric
- npm.io page: https://npm.io/package/extract-files

## Dependencies (1)

- [is-plain-obj](https://npm.io/package/is-plain-obj.md) ^4.1.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 14.0.0 (latest) — 2026-07-24
- 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
- … 7 more at https://npm.io/package/extract-files/versions

## 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`](https://developer.mozilla.org/en-US/docs/Web/API/FileList) instances are treated as [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) instance arrays. Files are typically [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) and [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) instances.

Used by [GraphQL multipart request spec client implementations](https://github.com/jaydenseric/graphql-multipart-request-spec#implementations) such as [`graphql-react`](https://npm.im/graphql-react) and [`apollo-upload-client`](https://npm.im/apollo-upload-client).

## Installation

For [Node.js](https://nodejs.org), to install [`extract-files`](https://npm.im/extract-files) with [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), run:

```sh
npm install extract-files
```

For [Deno](https://deno.land) and browsers, an example import map:

```json
{
  "imports": {
    "extract-files/": "https://unpkg.com/extract-files@14.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`](./extractFiles.mjs) to get started.

## Requirements

Supported runtime environments:

- [Node.js](https://nodejs.org) versions `^22.13.0 || ^24.0.0 || >=26.0.0`.
- [Deno](https://deno.land), importing from a CDN that might require an import map for dependencies.
- Browsers matching the [Browserslist](https://browsersl.ist) query [`> 0.5%, not OperaMini all, not dead`](https://browsersl.ist/?q=%3E+0.5%25%2C+not+OperaMini+all%2C+not+dead).

Non [Deno](https://deno.land) projects must configure [TypeScript](https://typescriptlang.org) to use types from the ECMAScript modules that have a `// @ts-check` comment:

- [`compilerOptions.allowJs`](https://typescriptlang.org/tsconfig#allowJs) should be `true`.
- [`compilerOptions.maxNodeModuleJsDepth`](https://typescriptlang.org/tsconfig#maxNodeModuleJsDepth) should be reasonably large, e.g. `10`.
- [`compilerOptions.module`](https://typescriptlang.org/tsconfig#module) should be `"node16"` or `"nodenext"`.

## Exports

The [npm](https://npmjs.com) package [`extract-files`](https://npm.im/extract-files) features [optimal JavaScript module design](https://jaydenseric.com/blog/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`](./package.json) field [`exports`](https://nodejs.org/api/packages.html#exports):

- [`extractFiles.mjs`](./extractFiles.mjs)
- [`isExtractableFile.mjs`](./isExtractableFile.mjs)

---
_Source: https://npm.io/package/extract-files · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
