UNPKG

pnpm

Version:

Fast, disk space efficient package manager

112 lines (111 loc) • 8.52 kB
{ "_args": [ [ { "raw": "tar-fs@^2.0.0", "scope": null, "escapedName": "tar-fs", "name": "tar-fs", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/unpack-stream" ] ], "_from": "tar-fs@^2.0.0", "_hasShrinkwrap": false, "_id": "tar-fs@2.0.0", "_location": "/tar-fs", "_nodeVersion": "10.15.1", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/tar-fs_2.0.0_1549274570344_0.9889846152819155" }, "_npmUser": { "name": "mafintosh", "email": "mathiasbuus@gmail.com" }, "_npmVersion": "6.4.1", "_phantomChildren": {}, "_requested": { "raw": "tar-fs@^2.0.0", "scope": null, "escapedName": "tar-fs", "name": "tar-fs", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "_requiredBy": [ "/unpack-stream" ], "_resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.0.tgz", "_shasum": "677700fc0c8b337a78bee3623fdc235f21d7afad", "_shrinkwrap": null, "_spec": "tar-fs@^2.0.0", "_where": "/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/unpack-stream", "author": { "name": "Mathias Buus" }, "bugs": { "url": "https://github.com/mafintosh/tar-fs/issues" }, "dependencies": { "chownr": "^1.1.1", "mkdirp": "^0.5.1", "pump": "^3.0.0", "tar-stream": "^2.0.0" }, "description": "filesystem bindings for tar-stream", "devDependencies": { "rimraf": "^2.6.3", "standard": "^12.0.1", "tape": "^4.9.2" }, "directories": { "test": "test" }, "dist": { "integrity": "sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA==", "shasum": "677700fc0c8b337a78bee3623fdc235f21d7afad", "tarball": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.0.tgz", "fileCount": 16, "unpackedSize": 27705, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWA3KCRA9TVsSAnZWagAAgBYP/2NCAKV0XURM2q4H6qER\nHsOK98IRMRfFjn6hchrEIXS3oG5AADK10S+314eEogSwNeynTSW9HDSiSFEP\nQNx2jpi1rgrL3A2QO8tctCXWqMmQXvlWef6AXdi8DPAPBE1yukKo8gkUUYx7\n89e1l6y8u83QmEqXnYThVh1lmP9VXHQznrZMfsRed1Fu9nwW/DIkULvJ25/J\nF58AUkyGOgK1e89gxMZVaqjUO8XU1H3y0dFFGBSHt/B0VWt9aIU/e6V7PCXF\nYGVlU0jiS22wS3yfROBdR0KXdewS4raM+K5n9hze0JLR77SybXlVM6s9ccJu\nRsf1lwvu9Hlnljn55XeasB82UxSVIaFFdVEnm46AmjW3Qy12WqCTrcwoVg2u\nH0yzcOQx/z8xD1aCqaCs2bVuz7Xxi0kCdMoDsvYMTKEf0SPvKxZp+epQLtJ4\nsp4pWdIfABxIp+Bp6lsAOiunxzvL+W5WAGignjCQ4apWLqexMOlgeBDFvCf0\n+49PllFd2TM68WgldCmMC0jDQvpdrzyDxJQXJ52F63GHllkzo3ajlcoV8/bS\nZ3O8xthTQ4oGWQrK5mRRIpUfMzer+tIqJWB15oRVW6mMxRBEH/WHK5Wcma2Q\nSXdYKFAH59SIDL2Dmnm8vhOydsNq8rYvPTKxMevrhJneBDbp5JUkUK3RIRdR\nn0IO\r\n=kxCL\r\n-----END PGP SIGNATURE-----\r\n" }, "gitHead": "0f54a78bcc8735c4257177fd004c2f9e55c588bb", "homepage": "https://github.com/mafintosh/tar-fs", "keywords": [ "tar", "fs", "file", "tarball", "directory", "stream" ], "license": "MIT", "main": "index.js", "maintainers": [ { "name": "mafintosh", "email": "mathiasbuus@gmail.com" }, { "name": "maxogden", "email": "max@maxogden.com" } ], "name": "tar-fs", "optionalDependencies": {}, "readme": "# tar-fs\n\nfilesystem bindings for [tar-stream](https://github.com/mafintosh/tar-stream).\n\n```\nnpm install tar-fs\n```\n\n[![build status](https://secure.travis-ci.org/mafintosh/tar-fs.png)](http://travis-ci.org/mafintosh/tar-fs)\n\n## Usage\n\ntar-fs allows you to pack directories into tarballs and extract tarballs into directories.\n\nIt doesn't gunzip for you, so if you want to extract a `.tar.gz` with this you'll need to use something like [gunzip-maybe](https://github.com/mafintosh/gunzip-maybe) in addition to this.\n\n``` js\nvar tar = require('tar-fs')\nvar fs = require('fs')\n\n// packing a directory\ntar.pack('./my-directory').pipe(fs.createWriteStream('my-tarball.tar'))\n\n// extracting a directory\nfs.createReadStream('my-other-tarball.tar').pipe(tar.extract('./my-other-directory'))\n```\n\nTo ignore various files when packing or extracting add a ignore function to the options. `ignore`\nis also an alias for `filter`. Additionally you get `header` if you use ignore while extracting.\nThat way you could also filter by metadata.\n\n``` js\nvar pack = tar.pack('./my-directory', {\n ignore: function(name) {\n return path.extname(name) === '.bin' // ignore .bin files when packing\n }\n})\n\nvar extract = tar.extract('./my-other-directory', {\n ignore: function(name) {\n return path.extname(name) === '.bin' // ignore .bin files inside the tarball when extracing\n }\n})\n\nvar extractFilesDirs = tar.extract('./my-other-other-directory', {\n ignore: function(_, header) {\n // pass files & directories, ignore e.g. symlinks\n return header.type !== 'file' && header.type !== 'directory'\n }\n})\n```\n\nYou can also specify which entries to pack using the `entries` option\n\n```js\nvar pack = tar.pack('./my-directory', {\n entries: ['file1', 'subdir/file2'] // only the specific entries will be packed\n})\n```\n\nIf you want to modify the headers when packing/extracting add a map function to the options\n\n``` js\nvar pack = tar.pack('./my-directory', {\n map: function(header) {\n header.name = 'prefixed/'+header.name\n return header\n }\n})\n\nvar extract = tar.extract('./my-directory', {\n map: function(header) {\n header.name = 'another-prefix/'+header.name\n return header\n }\n})\n```\n\nSimilarly you can use `mapStream` incase you wanna modify the input/output file streams\n\n``` js\nvar pack = tar.pack('./my-directory', {\n mapStream: function(fileStream, header) {\n if (path.extname(header.name) === '.js') {\n return fileStream.pipe(someTransform)\n }\n return fileStream;\n }\n})\n\nvar extract = tar.extract('./my-directory', {\n mapStream: function(fileStream, header) {\n if (path.extname(header.name) === '.js') {\n return fileStream.pipe(someTransform)\n }\n return fileStream;\n }\n})\n```\n\nSet `options.fmode` and `options.dmode` to ensure that files/directories extracted have the corresponding modes\n\n``` js\nvar extract = tar.extract('./my-directory', {\n dmode: parseInt(555, 8), // all dirs should be readable\n fmode: parseInt(444, 8) // all files should be readable\n})\n```\n\nIt can be useful to use `dmode` and `fmode` if you are packing/unpacking tarballs between *nix/windows to ensure that all files/directories unpacked are readable.\n\nAlternatively you can set `options.readable` and/or `options.writable` to set the dmode and fmode to readable/writable.\n\n``` js\nvar extract = tar.extract('./my-directory', {\n readable: true, // all dirs and files should be readable\n writable: true, // all dirs and files should be writable\n})\n```\n\nSet `options.strict` to `false` if you want to ignore errors due to unsupported entry types (like device files)\n\nTo dereference symlinks (pack the contents of the symlink instead of the link itself) set `options.dereference` to `true`.\n\n## Copy a directory\n\nCopying a directory with permissions and mtime intact is as simple as\n\n``` js\ntar.pack('source-directory').pipe(tar.extract('dest-directory'))\n```\n\n## Interaction with [`tar-stream`](https://github.com/mafintosh/tar-stream)\n\nUse `finalize: false` and the `finish` hook to\nleave the pack stream open for further entries (see\n[`tar-stream#pack`](https://github.com/mafintosh/tar-stream#packing)),\nand use `pack` to pass an existing pack stream.\n\n``` js\nvar mypack = tar.pack('./my-directory', {\n finalize: false,\n finish: function(sameAsMypack) {\n mypack.entry({name: 'generated-file.txt'}, \"hello\")\n tar.pack('./other-directory', {\n pack: sameAsMypack\n })\n }\n})\n```\n\n\n## Performance\n\nPacking and extracting a 6.1 GB with 2496 directories and 2398 files yields the following results on my Macbook Air.\n[See the benchmark here](https://gist.github.com/mafintosh/8102201)\n\n* tar-fs: 34.261 ms\n* [node-tar](https://github.com/isaacs/node-tar): 366.123 ms (or 10x slower)\n\n## License\n\nMIT\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/mafintosh/tar-fs.git" }, "scripts": { "test": "standard && tape test/index.js" }, "version": "2.0.0" }