pnpm
Version:
Fast, disk space efficient package manager
131 lines (130 loc) • 9.66 kB
JSON
{
"_args": [
[
{
"raw": "tar-stream@^2.0.0",
"scope": null,
"escapedName": "tar-stream",
"name": "tar-stream",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/tar-fs"
]
],
"_from": "tar-stream@^2.0.0",
"_hasShrinkwrap": false,
"_id": "tar-stream@2.0.1",
"_location": "/tar-stream",
"_nodeVersion": "10.15.1",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/tar-stream_2.0.1_1551352463108_0.836535531557645"
},
"_npmUser": {
"name": "mafintosh",
"email": "mathiasbuus@gmail.com"
},
"_npmVersion": "6.4.1",
"_phantomChildren": {
"inherits": "2.0.3",
"string_decoder": "1.1.1",
"util-deprecate": "1.0.2"
},
"_requested": {
"raw": "tar-stream@^2.0.0",
"scope": null,
"escapedName": "tar-stream",
"name": "tar-stream",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/tar-fs"
],
"_resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.0.1.tgz",
"_shasum": "42fbe41cd1cc5e6657c813e7d98e7afca2858a8c",
"_shrinkwrap": null,
"_spec": "tar-stream@^2.0.0",
"_where": "/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/tar-fs",
"author": {
"name": "Mathias Buus",
"email": "mathiasbuus@gmail.com"
},
"bugs": {
"url": "https://github.com/mafintosh/tar-stream/issues"
},
"dependencies": {
"bl": "^3.0.0",
"end-of-stream": "^1.4.1",
"fs-constants": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^3.1.1"
},
"description": "tar-stream is a streaming tar parser and generator and nothing else. It is streams2 and operates purely using streams which means you can easily extract/parse tarballs without ever hitting the file system.",
"devDependencies": {
"concat-stream": "^2.0.0",
"standard": "^12.0.1",
"tape": "^4.9.2"
},
"directories": {
"test": "test"
},
"dist": {
"integrity": "sha512-I6OJF7wE62BC6zNPdHDtseK0D0187PBjbKSLYY4ffvVkBM6tyBn2O9plDvVM2229/mozfEL/X3++qSvYYQE2xw==",
"shasum": "42fbe41cd1cc5e6657c813e7d98e7afca2858a8c",
"tarball": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.0.1.tgz",
"fileCount": 7,
"unpackedSize": 26568,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcd8KPCRA9TVsSAnZWagAAOVAQAIO6JdBtaB+WHMWiTJao\n3/6+Qivpawir7MHOCyHhOMDcLHOjay0DMIN8bztTk/d9vqrsPBpzQNdxdTg/\nXYZZWB+OY69aiBbX/WX3yQt366G1ykYNYAlALZBrxK6qPUofFNpcFOiFoH3L\nFLqTaNfyirW3mPDmiZudFD6+E98r6Xe8+U75P1j52qCbWPbIKAh58ArljHFS\nyXk6RUQqKp7qQyCNwXhVvCaERBwBGTdlKdZlnIycun9NmiUBeZVPyJfzTVcK\nzpY93u/X6WyqKJ85mXS4kaSWmd/GLJgF94OFaH973NW4/9J1KPG2uYFZZ8OW\ngTCbO8nUG19NaYbWApoZ5B2N+CKo0ApyC5aZfYD40jr6Chfeylh3ofXVY/OV\nUIPuJ9p4Jl/ODtWoZ4+AQsaSpKYCw+mnRLCjXzBQJoNI9aKgljht8AoZlJhB\noGIGoi49fkEFECW/5KCxZaCKWSCDlBZAe4O9TmyMPK/MDIylPIgR3iEo5H2h\nQSNPJXGRSX97mu2CAGnfhRbgawgIK2A9ZYqdwKIuPMdC59s3h0ZLXaIXSqY6\nfxgSUUdWZ1htlV/Oev/TqOUrTmDyYY4eykRo8PaCk2NDNlJBhjEI/1gDMZLA\nbkOz3cMnAzcLvx0MWSf5Jkpk9NVPPfKddE/iykA/Cs0GC4LBDjw1861/SMAX\n8oDl\r\n=2yYj\r\n-----END PGP SIGNATURE-----\r\n"
},
"files": [
"*.js",
"LICENSE"
],
"gitHead": "b6392bdc8a3c28288a33508f152cfb98eb0c776f",
"homepage": "https://github.com/mafintosh/tar-stream",
"keywords": [
"tar",
"tarball",
"parse",
"parser",
"generate",
"generator",
"stream",
"stream2",
"streams",
"streams2",
"streaming",
"pack",
"extract",
"modify"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "mafintosh",
"email": "mathiasbuus@gmail.com"
},
{
"name": "maxogden",
"email": "max@maxogden.com"
}
],
"name": "tar-stream",
"optionalDependencies": {},
"readme": "# tar-stream\n\ntar-stream is a streaming tar parser and generator and nothing else. It is streams2 and operates purely using streams which means you can easily extract/parse tarballs without ever hitting the file system.\n\nNote that you still need to gunzip your data if you have a `.tar.gz`. We recommend using [gunzip-maybe](https://github.com/mafintosh/gunzip-maybe) in conjunction with this.\n\n```\nnpm install tar-stream\n```\n\n[](http://travis-ci.org/mafintosh/tar-stream)\n[](http://opensource.org/licenses/MIT)\n\n## Usage\n\ntar-stream exposes two streams, [pack](https://github.com/mafintosh/tar-stream#packing) which creates tarballs and [extract](https://github.com/mafintosh/tar-stream#extracting) which extracts tarballs. To [modify an existing tarball](https://github.com/mafintosh/tar-stream#modifying-existing-tarballs) use both.\n\n\nIt implementes USTAR with additional support for pax extended headers. It should be compatible with all popular tar distributions out there (gnutar, bsdtar etc)\n\n## Related\n\nIf you want to pack/unpack directories on the file system check out [tar-fs](https://github.com/mafintosh/tar-fs) which provides file system bindings to this module.\n\n## Packing\n\nTo create a pack stream use `tar.pack()` and call `pack.entry(header, [callback])` to add tar entries.\n\n``` js\nvar tar = require('tar-stream')\nvar pack = tar.pack() // pack is a streams2 stream\n\n// add a file called my-test.txt with the content \"Hello World!\"\npack.entry({ name: 'my-test.txt' }, 'Hello World!')\n\n// add a file called my-stream-test.txt from a stream\nvar entry = pack.entry({ name: 'my-stream-test.txt', size: 11 }, function(err) {\n // the stream was added\n // no more entries\n pack.finalize()\n})\n\nentry.write('hello')\nentry.write(' ')\nentry.write('world')\nentry.end()\n\n// pipe the pack stream somewhere\npack.pipe(process.stdout)\n```\n\n## Extracting\n\nTo extract a stream use `tar.extract()` and listen for `extract.on('entry', (header, stream, next) )`\n\n``` js\nvar extract = tar.extract()\n\nextract.on('entry', function(header, stream, next) {\n // header is the tar header\n // stream is the content body (might be an empty stream)\n // call next when you are done with this entry\n\n stream.on('end', function() {\n next() // ready for next entry\n })\n\n stream.resume() // just auto drain the stream\n})\n\nextract.on('finish', function() {\n // all entries read\n})\n\npack.pipe(extract)\n```\n\nThe tar archive is streamed sequentially, meaning you **must** drain each entry's stream as you get them or else the main extract stream will receive backpressure and stop reading.\n\n## Headers\n\nThe header object using in `entry` should contain the following properties.\nMost of these values can be found by stat'ing a file.\n\n``` js\n{\n name: 'path/to/this/entry.txt',\n size: 1314, // entry size. defaults to 0\n mode: 0644, // entry mode. defaults to to 0755 for dirs and 0644 otherwise\n mtime: new Date(), // last modified date for entry. defaults to now.\n type: 'file', // type of entry. defaults to file. can be:\n // file | link | symlink | directory | block-device\n // character-device | fifo | contiguous-file\n linkname: 'path', // linked file name\n uid: 0, // uid of entry owner. defaults to 0\n gid: 0, // gid of entry owner. defaults to 0\n uname: 'maf', // uname of entry owner. defaults to null\n gname: 'staff', // gname of entry owner. defaults to null\n devmajor: 0, // device major version. defaults to 0\n devminor: 0 // device minor version. defaults to 0\n}\n```\n\n## Modifying existing tarballs\n\nUsing tar-stream it is easy to rewrite paths / change modes etc in an existing tarball.\n\n``` js\nvar extract = tar.extract()\nvar pack = tar.pack()\nvar path = require('path')\n\nextract.on('entry', function(header, stream, callback) {\n // let's prefix all names with 'tmp'\n header.name = path.join('tmp', header.name)\n // write the new entry to the pack stream\n stream.pipe(pack.entry(header, callback))\n})\n\nextract.on('finish', function() {\n // all entries done - lets finalize it\n pack.finalize()\n})\n\n// pipe the old tarball to the extractor\noldTarballStream.pipe(extract)\n\n// pipe the new tarball the another stream\npack.pipe(newTarballStream)\n```\n\n## Saving tarball to fs\n\n\n``` js\nvar fs = require('fs')\nvar tar = require('tar-stream')\n\nvar pack = tar.pack() // pack is a streams2 stream\nvar path = 'YourTarBall.tar'\nvar yourTarball = fs.createWriteStream(path)\n\n// add a file called YourFile.txt with the content \"Hello World!\"\npack.entry({name: 'YourFile.txt'}, 'Hello World!', function (err) {\n if (err) throw err\n pack.finalize()\n})\n\n// pipe the pack stream to your file\npack.pipe(yourTarball)\n\nyourTarball.on('close', function () {\n console.log(path + ' has been written')\n fs.stat(path, function(err, stats) {\n if (err) throw err\n console.log(stats)\n console.log('Got file info successfully!')\n })\n})\n```\n\n## Performance\n\n[See tar-fs for a performance comparison with node-tar](https://github.com/mafintosh/tar-fs/blob/master/README.md#performance)\n\n# License\n\nMIT\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/mafintosh/tar-stream.git"
},
"scripts": {
"test": "standard && tape test/extract.js test/pack.js",
"test-all": "standard && tape test/*.js"
},
"version": "2.0.1"
}