Skip to content

finnp/cpio-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

streaming cpio parser and packer

Resources

Stars

Watchers

Forks

Packages

No packages published