Skip to content

Replacements for tar-fs

modern-tar

tar-fs provides filesystem bindings on top of tar-stream. modern-tar covers the same workflows through modern-tar/fs, with zero dependencies and built-in TypeScript types.

Example:

js
import tar from 'tar-fs'
import { createReadStream, createWriteStream } from 'node:fs'
import { packTar, unpackTar } from 'modern-tar/fs'
import { pipeline } from 'node:stream/promises'

tar.pack('./my-directory').pipe(createWriteStream('my-tarball.tar')) 
await pipeline(packTar('./my-directory'), createWriteStream('my-tarball.tar')) 

createReadStream('my-other-tarball.tar').pipe( 
  tar.extract('./my-other-directory') 
) 
await pipeline( 
  createReadStream('my-other-tarball.tar'), 
  unpackTar('./my-other-directory') 
) 

Released under the MIT License. (6352c556)