{"name":"it-tar","version":"6.0.6","description":"it-tar is a streaming tar parser (and maybe a generator in the future) and nothing else. It operates purely using async iterables which means you can easily extract/parse tarballs without ever hitting the file system.","author":{"name":"Alan Shaw"},"license":"Apache-2.0 OR MIT","homepage":"https://github.com/alanshaw/it-tar#readme","repository":{"type":"git","url":"git+https://github.com/alanshaw/it-tar.git"},"bugs":{"url":"https://github.com/alanshaw/it-tar/issues"},"publishConfig":{"access":"public","provenance":true},"keywords":["extract","generate","generator","modify","pack","parse","parser","stream","stream2","streaming","streams","streams2","tar","tarball"],"type":"module","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js","module-sync":"./dist/src/index.js"}},"release":{"branches":["master"],"plugins":[["@semantic-release/commit-analyzer",{"preset":"conventionalcommits","releaseRules":[{"breaking":true,"release":"major"},{"revert":true,"release":"patch"},{"type":"feat","release":"minor"},{"type":"fix","release":"patch"},{"type":"docs","release":"patch"},{"type":"test","release":"patch"},{"type":"deps","release":"patch"},{"scope":"no-release","release":false}]}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits","presetConfig":{"types":[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"chore","section":"Trivial Changes"},{"type":"docs","section":"Documentation"},{"type":"deps","section":"Dependencies"},{"type":"test","section":"Tests"}]}}],"@semantic-release/changelog","@semantic-release/npm","@semantic-release/github",["@semantic-release/git",{"assets":["CHANGELOG.md","package.json"]}]]},"scripts":{"clean":"aegir clean","lint":"aegir lint","docs":"aegir docs","dep-check":"aegir dep-check","doc-check":"aegir doc-check","build":"aegir build","postbuild":"cp ./test/fixtures/*.tar ./test/fixtures/*.tar.gz ./test/fixtures/*.tgz ./dist/test/fixtures","test":"aegir test -t node","test:node":"npm run test -- -t node --cov","test:electron-main":"npm run test -- -t electron-main","release":"aegir release"},"dependencies":{"iso-constants":"^0.1.2","it-reader":"^7.0.0","it-stream-types":"^2.0.1","it-to-buffer":"^5.0.0","p-defer":"^4.0.0","uint8arraylist":"^3.0.2","uint8arrays":"^6.1.1"},"devDependencies":{"aegir":"^48.1.1","it-pipe":"^3.0.1","stream-to-it":"^1.0.1"},"engines":{"node":">=16.0.0","npm":">=7.0.0"},"gitHead":"500d30d2cf5c87146dbf808cb7a40324998366f2","_id":"it-tar@6.0.6","_nodeVersion":"24.18.0","_npmVersion":"11.18.0","dist":{"integrity":"sha512-+DXnOod8oC8iWEabGmQ039l5RnAeI4i6pl1BrPD1Bu1pGCy4YgxX1LjoJsj/OPLdXguOSH0pg/0rfceMhPEXXQ==","shasum":"6fca80f9820c823538458300361981d8c774996e","tarball":"http://registry-npm.ywwl.com/it-tar/download/it-tar-6.0.6.tgz","fileCount":35,"unpackedSize":316636,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/it-tar@6.0.6","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAyI/bpE23+rZjRSjFT0lZtk0lAuHavB6J2iBo6tJXv8AiA1FfY6diDrCgNopRUAP8ca1n1K2prlZ7Cw2IkCJzORgQ=="}],"size":83135,"noattachment":false,"key":"/it-tar/-/it-tar-6.0.6.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:4d694fb6-3247-4343-8d7b-69bc90595bac"}},"directories":{},"maintainers":[{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"alanshaw","email":"alan138@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/it-tar_6.0.6_1783066780042_0.9033583790410322"},"_hasShrinkwrap":false,"readme":"# it-tar\n\n[![codecov](https://img.shields.io/codecov/c/github/alanshaw/it-tar.svg?style=flat-square)](https://codecov.io/gh/alanshaw/it-tar)\n[![CI](https://img.shields.io/github/actions/workflow/status/alanshaw/it-tar/js-test-and-release.yml?branch=master\\&style=flat-square)](https://github.com/alanshaw/it-tar/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n> it-tar is a streaming tar parser (and maybe a generator in the future) and nothing else. It operates purely using async iterables which means you can easily extract/parse tarballs without ever hitting the file system.\n\n# About\n\n<!--\n\n!IMPORTANT!\n\nEverything in this README between \"# About\" and \"# Install\" is automatically\ngenerated and will be overwritten the next time the doc generator is run.\n\nTo make changes to this section, please update the @packageDocumentation section\nof src/index.js or src/index.ts\n\nTo experiment with formatting, please run \"npm run docs\" from the root of this\nrepo and examine the changes made.\n\n-->\n\n`it-tar` [packs](#packing) and [extracts](#extracts) tarballs.\n\nIt implements USTAR with additional support for pax extended headers. It should be compatible with all popular tar distributions out there (gnutar, bsdtar etc)\n\n## Example - Packing\n\nTo create a pack stream use `tar.pack()` and pipe entries to it.\n\n```TypeScript\nimport fs from 'node:fs'\nimport * as Tar from 'it-tar'\nimport { pipe } from 'it-pipe'\nimport { sink } from 'stream-to-it'\n\nawait pipe(\n  [\n    // add a file called my-test.txt with the content \"Hello World!\"\n    {\n      header: { name: 'my-test.txt' },\n      body: 'Hello World!'\n    },\n    // add a file called my-stream-test.txt from a stream\n    {\n      header: { name: 'my-stream-test.txt', size: 11 },\n      body: fs.createReadStream('./my-stream-test.txt')\n    }\n  ],\n  Tar.pack(),\n  // pipe the pack stream somewhere\n  sink(process.stdout)\n)\n```\n\n## Example - Extracting\n\nTo extract a stream use `tar.extract()` and pipe a [source iterable](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#source-it) to it.\n\n```TypeScript\nimport * as Tar from 'it-tar'\nimport { pipe } from 'it-pipe'\n\nawait pipe(\n  [Uint8Array.from([0, 1, 2, 3, 4])], // An async iterable (for example a Node.js readable stream)\n  Tar.extract(),\n  async source => {\n    for await (const entry of source) {\n      // entry.header is the tar header (see below)\n      // entry.body is the content body (might be an empty async iterable)\n      for await (const data of entry.body) {\n        // do something with the data\n      }\n    }\n    // all entries read\n  }\n)\n```\n\nThe tar archive is streamed sequentially, meaning you **must** drain each entry's body as you get them or else the main extract stream will receive backpressure and stop reading.\n\nNote that the body stream yields [`Uint8ArrayList`](https://npm.im/uint8arraylist) objects **not** `Uint8Arrays`s.\n\n## Example - Modifying existing tarballs\n\nUsing tar-stream it is easy to rewrite paths / change modes etc in an existing tarball.\n\n```TypeScript\nimport * as Tar from 'it-tar'\nimport { pipe } from 'it-pipe'\nimport { sink } from 'stream-to-it'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nawait pipe(\n  fs.createReadStream('./old-tarball.tar'),\n  Tar.extract(),\n  async function * (source) {\n    for await (const entry of source) {\n      // let's prefix all names with 'tmp'\n      entry.header.name = path.join('tmp', entry.header.name)\n      // write the new entry to the pack stream\n      yield entry\n    }\n  },\n  Tar.pack(),\n  sink(fs.createWriteStream('./new-tarball.tar'))\n)\n```\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## Related\n\n- [`it-pipe`](https://www.npmjs.com/package/it-pipe) Utility to \"pipe\" async iterables together\n- [`it-reader`](https://www.npmjs.com/package/it-reader) Read an exact number of bytes from a binary (async) iterable\n- [`stream-to-it`](https://www.npmjs.com/package/stream-to-it) Convert Node.js streams to streaming iterables\n\n# Install\n\n```console\n$ npm i it-tar\n```\n\n# API Docs\n\n- <https://alanshaw.github.io/it-tar>\n\n# License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](https://github.com/alanshaw/it-tar/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](https://github.com/alanshaw/it-tar/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n# Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","publish_time":1783066780239,"_cnpm_publish_time":1783066780239,"dist-tags":{"latest":"6.0.6"}}