isaacs / node-tar

tar for node
ISC License
837 stars 183 forks source link

TypeError: invalid base256 encoding #221

Closed Christilut closed 5 years ago

Christilut commented 5 years ago

I'm trying to stream a targz file and then stream the unzipped file inside so I can read that file line by line. This is already a bit of an experiment for me to see if I can get this working. I think I should be using tar.Parse for this but I'm getting the following error:

TypeError: invalid base256 encoding

This is my code:

async function unzip (path) {
  return new Promise((resolve, reject) => {
    const stream = fs.createReadStream(path)

    const parser = new tar.Parse({
      filter: function (path) {
        console.log(path);

        return path === 'itunes20190710/song_mix'
      },

      onentry: function (entry) {
        console.log(entry) // Never gets here

        resolve()
      }
    })

    stream.pipe(parser)
  })
}

You can find the file I'm working with here

Am I doing something wrong here or is the file not in the right format?

Christilut commented 5 years ago

This is probably because it's a bzip2 file and not a targz file, oops