1.4.3 • Published 3 years ago

cpio-stream v1.4.3

Weekly downloads
280
License
MIT
Repository
github
Last release
3 years ago

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

1.4.3

3 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.0

9 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

11 years ago