Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/modules/tar-fs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
description: Lighter alternative to the tar-fs package for packing and extracting tar archives on the filesystem
---

# Replacements for `tar-fs`

## `modern-tar`

[`tar-fs`](https://github.com/mafintosh/tar-fs) provides filesystem bindings on top of [`tar-stream`](https://github.com/mafintosh/tar-stream). [`modern-tar`](https://github.com/ayuhito/modern-tar) covers the same workflows through [`modern-tar/fs`](https://github.com/ayuhito/modern-tar), with zero dependencies and built-in TypeScript types.

Example:

<!-- prettier-ignore -->
```js
import tar from 'tar-fs' // [!code --]
import { createReadStream, createWriteStream } from 'node:fs' // [!code ++]
import { packTar, unpackTar } from 'modern-tar/fs' // [!code ++]
import { pipeline } from 'node:stream/promises' // [!code ++]

tar.pack('./my-directory').pipe(createWriteStream('my-tarball.tar')) // [!code --]
await pipeline(packTar('./my-directory'), createWriteStream('my-tarball.tar')) // [!code ++]

createReadStream('my-other-tarball.tar').pipe( // [!code --]
tar.extract('./my-other-directory') // [!code --]
) // [!code --]
await pipeline( // [!code ++]
createReadStream('my-other-tarball.tar'), // [!code ++]
unpackTar('./my-other-directory') // [!code ++]
) // [!code ++]
```
11 changes: 11 additions & 0 deletions manifests/preferred.json
Original file line number Diff line number Diff line change
Expand Up @@ -2610,6 +2610,12 @@
"replacements": ["util.stripVTControlCharacters", "Bun.stripANSI"],
"url": {"type": "e18e", "id": "strip-ansi"}
},
"tar-fs": {
"type": "module",
"moduleName": "tar-fs",
"replacements": ["modern-tar"],
"url": {"type": "e18e", "id": "tar-fs"}
},
"teeny-request": {
"type": "module",
"moduleName": "teeny-request",
Expand Down Expand Up @@ -3311,6 +3317,11 @@
"type": "documented",
"replacementModule": "milliparsec"
},
"modern-tar": {
"id": "modern-tar",
"type": "documented",
"replacementModule": "modern-tar"
},
"mri": {"id": "mri", "type": "documented", "replacementModule": "mri"},
"nano-staged": {
"id": "nano-staged",
Expand Down