node-tar icon indicating copy to clipboard operation
node-tar copied to clipboard

Add support for --delete option

Open nuest opened this issue 6 years ago • 3 comments

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 ?

nuest avatar Jul 27 '18 10:07 nuest

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?

isaacs avatar Oct 10 '18 20:10 isaacs

@nuest The tar.delete link you provided is broken.

yusufkhan07 avatar Aug 21 '21 05:08 yusufkhan07

@nuest The tar.delete link you provided is broken.

this is the working link https://www.gnu.org/software/tar/manual/tar.html#delete

iQuickDev avatar Dec 24 '22 11:12 iQuickDev