node-tar
node-tar copied to clipboard
Add support for --delete option
I need to replace a file in the tar, and get the desired result (see #149). I would prefer though to delete the file first and then re-append it.
Would you consider adding a tar.delete
, as described in https://www.gnu.org/software/tar/manual/html_section/tar_32.html#SEC66 ?
I'd be open to it.
In the meantime, you could work around this by creating a new archive with a filter function.
tar.create({
filter: entry => entry.path !== 'foo.txt' // the file to be deleted
file: 'new.tar'
}, ['@old.tar']).then(() => fs.renameSync('new.tar', 'old.tar'))
I imagine that's more or less how gnutar does it?
@nuest The tar.delete
link you provided is broken.
@nuest The
tar.delete
link you provided is broken.
this is the working link https://www.gnu.org/software/tar/manual/tar.html#delete