cpio-stream
v1.4.3
Published
streaming cpio parser and packer
Downloads
371
Readme
cpio-stream
cpio-stream
is a streaming cpio packer. It is basically the cpio
version on
tar-stream.
Support
Extraction
odc
/old character
newc
/new character
crc
/new crc
note: checksum will not be tested nor rejected!
Packing
odc
/old character
Mostly following the libarchive documentation documentation. Feel free to create pull requests to add additional format support!
Packing
var cpio = require('cpio-stream')
var pack = cpio.pack()
pack.entry({name: 'my-test.txt'}, 'hello, world\n')
var entry = pack.entry({'my-stream-test.txt', size: 11}, function (err) {
// stream was added
// no more entries
pack.finalize()
})
entry.write('hello')
entry.write(' world')
entry.end()
// pipe the archive somewhere
pack.pipe(process.stdout)
Extracting
var extract = cpio.extract()
extract.on('entry', function (header, stream, callback) {
stream.on('end', function () {
callback()
})
stream.resume() // auto drain
})
extract.on('finish', function () {
// all entries read
})
pack.pipe(extract)
License
MIT, with some of the code taken from the tar-stream
module by @mafintosh