Skip to content

Invalid tar header: unknown format. (for ExtendedName) #161

@jeroen

Description

@jeroen

The attached tar.gz was created with the default settings using gnutar on a directory containing a large filename. It seems to automatically have switched on extended file attributes (the tar contains a file ExtendedName).

LHsampling_0.1.0.tar.gz

It errors when trying to extract with tar-stream: Invalid tar header: unknown format.

A workaround is to use var extract = tar.extract({allowUnknownFormat:true});

var fs = require('fs');
var tar = require('tar-stream');
var gunzip = require('gunzip-maybe');

tar_list('./LHsampling_0.1.0.tar.gz')

function tar_list(path){
  var input = fs.createReadStream(path);
  var extract = tar.extract();
  extract.on('entry', function(header, file_stream, next_entry) {
    console.log(header.name)
    next_entry();
    file_stream.resume();
  });
  extract.on('finish', function() {
    console.log("Done!")
  });
  extract.on('error', function(err) {
    console.log("ERROR", err)
  });
  return input.pipe(gunzip()).pipe(extract);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions