mafintosh / tar-stream

tar-stream is a streaming tar parser and generator.
MIT License
400 stars 93 forks source link

skipping on entry, header errors #142

Closed zoobot closed 1 year ago

zoobot commented 1 year ago

I am getting an error but not really sure how to debug because I think it may skip tarStreamExtract.on("entry" function that shows the headers, any advice on how to investigate/debug the headers? I saw another poster said they needed to set the header size to 0.

  'Error: Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?\n    
  at exports.decode (test/node_modules/tar-stream/headers.js:262:43)\n 
  at Extract.onheader (test/node_modules/tar-stream/extract.js:123:39)\n    
  at Extract._write (test/node_modules/tar-stream/extract.js:24…e_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js:398:5)\n    
  at Writable.write (test/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js:307:11)\n    
  at PassThroughExt.ondata (node:internal/streams/readable:766:22)\n    
  at PassThroughExt.emit (node:events:537:28)\n    
  at addChunk (node:internal/streams/readable:324:12)\n    
  at readableAddChunk (node:internal/streams/readable:297:9)'
    layerStream.pipe(gunzip()) // uncompress if necessary, will pass thru if it's not gziped
           .pipe(digester) // compute hash and forward
           .pipe(tarStreamExtract) // extract from the tar

    tarStreamExtract.on("entry", function (header, stream, callback) {
      // moving to the right folder in tarball
      header.name = headerNewName
      // write to the tar
      stream.pipe(pack.entry(header, callback))
    })
mafintosh commented 1 year ago

hard to say, if you have a test i can help, re-open if still relevant :)