mafintosh/tar-fs

How to pack several directories/files ?

sroucheray opened this issue · 1 comments

Hi ! Nice work @mafintosh !
Could you provide an example packing several different directories/files please.
This simplified example lead me to an error :

...
let pack = require('tar-stream').pack();

tarfs.pack(path.join(__dirname, 'a', 'file.ini'), {
    pack: pack,
    map: function (header) {
        header.name = `file/${header.name}`;
        return header;
    }
});

tarfs.pack(path.join(__dirname, 'any', 'folder'), {
    pack: pack,
    map: function (header) {
        header.name = `folder/${header.name}`;
        return header;
    }
});

pack.pipe(outputStream);

This error :

  if (this._stream) throw new Error('already piping an entry')
                    ^
Error: already piping an entry
    at Pack.entry (E:\svn\michelin\lp2r\trunk\dev\decoupe\node_modules\tar-strea
m\pack.js:108:27)
    at onstat (E:\svn\michelin\lp2r\trunk\dev\decoupe\node_modules\tar-fs\index.
js:107:19)
    at E:\svn\michelin\lp2r\trunk\dev\decoupe\node_modules\tar-fs\index.js:40:9
    at FSReqWrap.oncomplete (fs.js:82:15)

checkout tar-fs for an easy way to do this