安装
npm install fast-extract
yarn add fast-extract
pnpm add fast-extract
bun add fast-extract
README

fast-extract

Extract contents from various archive types (tar, tar.bz2, tar.gz, tar.xz, tgz, zip).

var extract = require('fast-extract')

// provide the type
extract('/path/file', fullPath, { strip: 1, type: 'tar.gz' }, function(err) {})

// use the type
await extract('/path/file.tar.gz', fullPath, { strip: 1 })

// overwrite existing destination
await extract('/path/file.tar.gz', fullPath, { force: true })

Safe Extraction

fast-extract uses atomic writes to ensure safe extraction:

  1. Extracts to a temporary location first - Content is written to a temp path alongside the destination
  2. Removes existing destination - Only after successful extraction
  3. Atomic rename - Temp directory is renamed to final destination

This approach ensures you always have either the old content or the new content, never a partial extraction. If the process is interrupted mid-extraction, your destination remains untouched.

Conservative Overwrite Behavior

Unlike tar (which silently overwrites existing files by default), fast-extract requires explicit permission to overwrite:

Tool Default Behavior
tar Silently overwrites existing files
unzip Prompts before overwriting
fast-extract Fails if destination exists and is non-empty

To overwrite an existing destination, use the force option:

await extract('/path/file.tar.gz', existingPath, { force: true })

This conservative default prevents accidental data loss while still allowing overwrites when explicitly requested.

版本列表
1.14.8 2026-05-26
1.14.7 2026-05-26
1.14.6 2026-05-22
1.14.5 2026-05-22
1.14.4 2026-05-22
1.14.3 2026-05-22
1.14.2 2025-12-26
1.14.1 2025-12-25
1.14.0 2025-12-25
1.13.2 2025-12-25
1.13.1 2025-12-24
1.13.0 2025-12-22
1.12.1 2025-12-20
1.12.0 2025-12-20
1.11.0 2025-12-18
1.10.0 2025-12-17
1.9.1 2025-12-17
1.9.0 2025-12-17
1.8.19 2025-12-16
1.8.18 2025-12-16
1.8.17 2025-12-16
1.8.16 2025-12-12
1.8.15 2025-12-12
1.8.14 2025-12-12
1.8.13 2025-12-11
1.8.12 2025-12-07
1.8.11 2025-12-07
1.8.10 2025-12-06
1.8.9 2025-12-04
1.8.8 2025-12-04
1.8.7 2025-12-04
1.8.6 2025-12-04
1.8.5 2025-12-04
1.8.4 2025-12-04
1.8.3 2025-12-03
1.8.2 2025-12-03
1.8.1 2025-12-03
1.8.0 2025-12-01
1.7.6 2025-11-30
1.7.5 2025-11-06
1.7.4 2025-10-21
1.7.3 2025-10-21
1.7.2 2025-07-08
1.7.1 2025-06-30
1.7.0 2025-06-29
1.6.7 2025-06-29
1.6.6 2025-06-29
1.6.5 2025-06-29
1.6.4 2025-06-29
1.6.3 2025-06-28
1.6.2 2025-06-28
1.6.1 2025-06-28
1.6.0 2025-06-28
1.5.3 2025-06-28
1.5.2 2025-06-22
1.5.1 2025-06-22
1.5.0 2025-06-22
1.4.16 2025-06-21
1.4.15 2025-06-21
1.4.14 2025-06-21
1.4.13 2025-06-20
1.4.12 2025-06-18
1.4.11 2025-06-17
1.4.10 2025-06-15
1.4.9 2025-06-15
1.4.8 2025-06-15
1.4.7 2025-06-14
1.4.6 2025-06-14
1.4.5 2025-06-14
1.4.4 2025-05-24
1.4.3 2025-05-20
1.4.2 2025-05-19
1.4.1 2025-05-19
1.4.0 2025-05-19
1.3.35 2025-05-19
1.3.34 2025-05-18
1.3.33 2025-05-18
1.3.32 2025-05-18
1.3.31 2025-01-23
1.3.30 2025-01-23
1.3.29 2025-01-23
1.3.28 2025-01-23
1.3.27 2025-01-23
1.3.26 2025-01-23
1.3.25 2025-01-23
1.3.24 2025-01-23
1.3.23 2025-01-23
1.3.22 2025-01-23
1.3.21 2025-01-23
1.3.20 2025-01-15
1.3.19 2025-01-15
1.3.18 2025-01-15
1.3.17 2025-01-15
1.3.16 2025-01-14
1.3.15 2025-01-14
1.3.14 2025-01-14
1.3.13 2025-01-12
1.3.12 2025-01-12
1.3.11 2025-01-12
1.3.10 2025-01-04
1.3.9 2025-01-04
1.3.8 2025-01-04
1.3.7 2025-01-04
1.3.6 2025-01-04
1.3.5 2025-01-04
1.3.4 2025-01-04
1.3.3 2025-01-04
1.3.2 2025-01-04
1.3.1 2024-12-28
1.3.0 2024-12-25
1.2.8 2024-12-25
1.2.7 2024-12-22
1.2.6 2024-12-22
1.2.5 2024-12-16
1.2.4 2024-12-16
1.2.3 2024-12-16
1.2.2 2024-11-30
1.2.1 2024-11-29
1.2.0 2024-11-23
1.1.0 2024-02-24
1.0.1 2024-02-20
1.0.0 2024-02-18
0.5.0 2024-02-17
0.4.8 2022-08-15
0.4.7 2022-08-14
0.4.6 2022-08-14
0.4.5 2022-08-14
0.4.4 2022-08-13
0.4.3 2022-08-13
0.4.2 2022-08-13
0.4.1 2022-08-12
0.3.4 2022-07-21
0.3.3 2022-06-29
0.3.2 2022-06-29
0.3.1 2021-10-25
0.3.0 2021-07-26
0.2.9 2021-07-25
0.2.8 2020-07-08
0.2.7 2020-06-21
0.2.6 2020-06-19
0.2.5 2020-06-17
0.2.4 2020-06-12
0.2.3 2020-06-11
0.2.2 2020-06-11
0.2.1 2020-06-11
0.2.0 2020-06-06
0.1.24 2020-06-05
0.1.23 2020-06-05
0.1.22 2020-06-05
0.1.21 2020-06-04
0.1.20 2020-06-03
0.1.19 2020-06-03
0.1.18 2020-06-02
0.1.17 2020-06-01
0.1.16 2020-06-01
0.1.15 2020-05-31
0.1.14 2020-05-31
0.1.13 2020-05-31
0.1.11 2020-05-28
0.1.10 2020-05-25
0.1.9 2020-05-25
0.1.8 2020-05-24
0.1.7 2020-05-24
0.1.6 2020-05-24
0.1.5 2020-05-23
0.1.4 2020-05-23
0.1.3 2020-05-23
0.1.1 2020-05-23
0.1.0 2020-05-23