cpio-stream

1.4.3 • Public • Published

cpio-stream Build Status

NPM js-standard-style

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

Readme

Keywords

none

Package Sidebar

Install

npm i cpio-stream

Weekly Downloads

94

Version

1.4.3

License

MIT

Unpacked Size

18.3 kB

Total Files

11

Last publish

Collaborators

  • finnpauls
  • piranna