Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created May 15, 2019 17:49
Show Gist options
  • Save isaacs/1bc87e60ed1e578269ab5b76935c3217 to your computer and use it in GitHub Desktop.
Save isaacs/1bc87e60ed1e578269ab5b76935c3217 to your computer and use it in GitHub Desktop.
foo/000755 000765 000024 00000000000 13467050306 012253 5ustar00isaacsstaff000000 000000 foo/baz.txt000644 000765 000024 00000000004 13467050306 013562 0ustar00isaacsstaff000000 000000 baz
foo/foo.txt000644 000765 000024 00000000004 13467050306 013571 0ustar00isaacsstaff000000 000000 foo
foo/bar.txt000644 000765 000024 00000000004 13467050306 013552 0ustar00isaacsstaff000000 000000 bar
const tar = require('./')
const data = []
const file = 'foo.tar'
const onentry = entry => {
if (entry.path === 'foo/bar.txt')
entry.on('data', c => data.push(c))
}
tar.t({
onentry,
file,
}, er => {
const buf = Buffer.concat(data)
console.log('got the file data', buf.toString('hex'))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment