cel committed InitLatest: e6f6f89 on 5/20/2018, 4:04:26 PM | |
📄 | LICENSE |
📄 | README.md |
📄 | headers.js |
📄 | index.js |
📄 | package.json |
📁 | test |
README.md
pull-tar-extract
tar parser pull-stream. based on tar-stream.
Usage
pull-tar-extract
exposes a function which returns a through-stream which
consumes a tar file and produces a stream of entries.
Each entry is an object with a header
object property and read
function
property which is a pull-stream source of the contents of that entry (or is
empty if the entry is not a file).
The entry stream (entry.read
function) must be drained before the next
entry can be read.
var Extract = require('pull-tar-extract')
var pull = require('pull-stream')
var fs = require('fs')
pull(
pull.once(fs.readFileSync('package.tar')),
Extract(),
pull.drain(function (entry) {
console.log('entry:', entry.header.name)
pull(entry.read, pull.collect(function (err, bufs) {
if (err) throw err
var data = Buffer.concat(bufs)
console.log('contents:', data.toString('ascii'))
}))
}, function (err) {
if (err) throw err
// done
})
)
License
MIT
Built with git-ssb-web