tar
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download."Tar" for Node.js is a fully-featured, fast archive utility. It is designed to mimic the tar(1)
command's behavior on Unix systems by creating an archive of file system entries, which may include directories, files, links, etc. The name "tar" comes from "tape archive". It's created with an API allowing it to handle five main upper-level commands relating to creating, replacing, updating, listing, and extracting content from an archive. Tar is a particularly flexible and powerful tool in various coding situations, especially when dealing with large amounts of data.
The usage of "tar" differs depending on the specific action you want to perform on an archive. Here are usage examples for the main commands:
const tar = require('tar');
tar.c(
{
gzip: true,
file: 'my-tarball.tgz'
},
['file1', 'file2', 'directory']
).then(() => {
console.log('Tarball has been created.');
});
tar.x({
file: 'my-tarball.tgz'
}).then(() => {
console.log('Tarball has been extracted.');
});
tar.t({
file: 'my-tarball.tgz',
onentry: entry => console.log(entry.path)
});
The options object in each method can be used to further customize operation's behavior.
The documentation for the `