{"name":"it-concat","version":"3.0.1","description":"Concat all buffers/strings yielded from an async iterable into a single BufferList/string","author":{"name":"Alan Shaw"},"license":"Apache-2.0 OR MIT","homepage":"https://github.com/alanshaw/it-concat#readme","repository":{"type":"git","url":"git+https://github.com/alanshaw/it-concat.git"},"bugs":{"url":"https://github.com/alanshaw/it-concat/issues"},"keywords":["async","buffer","bufferlist","concat","glue","iterable","iterator","join","string"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"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"]},"scripts":{"lint":"aegir lint","dep-check":"aegir dep-check","build":"aegir build","test":"aegir test","test:chrome":"aegir test -t browser --cov","test:chrome-webworker":"aegir test -t webworker","test:firefox":"aegir test -t browser -- --browser firefox","test:firefox-webworker":"aegir test -t webworker -- --browser firefox","test:node":"aegir test -t node --cov","test:electron-main":"aegir test -t electron-main","release":"aegir release"},"dependencies":{"uint8arraylist":"^2.3.3","uint8arrays":"^4.0.2"},"devDependencies":{"aegir":"^37.5.6","iso-random-stream":"^2.0.2","random-int":"^3.0.0"},"gitHead":"65594012436ca5bea7e7d75aa07834e768f5eebb","_id":"it-concat@3.0.1","_nodeVersion":"16.17.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-adsCBiPaDM46TrrpmNPEWru++/oFiLWZAnteM5ODPs0NRkDfjDyom+qyXvag7bP/Kp3Z6Vqv+U1idZs5gmyIAg==","shasum":"71ffcc66e0f766af3caf61805de0d3106086cdc9","tarball":"http://registry-npm.ywwl.com/it-concat/download/it-concat-3.0.1.tgz","fileCount":8,"unpackedSize":15319,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGjYUv91WiWP1T+00sbUi1QlyyIVU6/VEeLhn3CjEWFnAiAqtLyM7EvElR4kOtFt6VYwvTJz0X//ImH3l/5Xo/7CDw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjTuEiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpc1Q//UImVZ09mvdlXCWu7FCKx4SY/ELyCNG4vh3NkFCYWLDtIZPyH\r\nXfCSzG/gLc8wPBBkI9x70mdbJ4D+ayJO6b/+ebGb5TeNWEXCsnGQihQoW4Mn\r\n4st27NR2Pd2lycM4lmbR9QmmJuT2HBmMIph8bcvBWuY5yDADypVzsfGNmVP1\r\nlL3Yr0eJbNRQBcysxiqb0im/baw/P3Ga3z9BKbB8FNdCmgxjv7B0fARMQCeS\r\nYH+o80dbA1L/j3Hdf058HryI1UMF22uuNp9T6cb1nUtNGptejWkElEDd8xKM\r\nl307fU7duB/hS1rVWbGGOWcSq2ViLa6a0chAcDnW03G+hEFp71OYbk195qWQ\r\n0v5NGr/mnEOJj1inwO3spDQq8+CJrjeT/47I38gF8LVU5xejLatJJ+ZH5bSm\r\nxWZRYWmErxG9umeBWPQT1SG6svmqupTpx2d3vpuyjDNIM7UDpl1h/cuOJBtI\r\nxYbR+AD27ms3Rhbn3xcbhHg5Lm0jBBFCVQpJsmmU97gIdmz7I6BY4tAD25BM\r\n9lKmAGeff/TR+XdrzLFx+p92k5pcRR3Czm/w5ahDaw1aZWw0vzp6c4Fh+PIH\r\nlptHnP7o7y/+lWHXA1PLE2RkjnmIRuqhT/jZDIFwPuL0VZObpV67vRFrxrL0\r\nFDrTrZOe5BLHsR470XhPHdi7vMTGEqpe3Ts=\r\n=JHpq\r\n-----END PGP SIGNATURE-----\r\n","size":4109,"noattachment":false,"key":"/it-concat/-/it-concat-3.0.1.tgz"},"_npmUser":{"name":"alanshaw","email":"alan138@gmail.com"},"directories":{},"maintainers":[{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"alanshaw","email":"alan138@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/it-concat_3.0.1_1666113826281_0.17166631848094926"},"_hasShrinkwrap":false,"readme":"# it-concat\n\n[![codecov](https://img.shields.io/codecov/c/github/alanshaw/it-concat.svg?style=flat-square)](https://codecov.io/gh/alanshaw/it-concat)\n[![CI](https://img.shields.io/github/actions/workflow/status/alanshaw/it-concat/js-test-and-release.yml?branch=master\\&style=flat-square)](https://github.com/alanshaw/it-concat/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n> Concat all buffers/strings yielded from an async iterable into a single BufferList/string\n\n# Install\n\n```console\n$ npm i it-concat\n```\n\n## Browser `<script>` tag\n\nLoading this module through a script tag will make it's exports available as `ItConcat` in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/it-concat/dist/index.min.js\"></script>\n```\n\n## Usage\n\nConcat Uint8Arrays to a single [`Uint8ArrayList`](https://www.npmjs.com/package/uint8arraylist):\n\n```js\nimport concat from 'it-concat'\nimport { toString } from 'uint8arrays'\nimport fs from 'fs'\n\nfs.writeFileSync('./test.txt', 'Hello World!')\n\n// Node.js Readable Streams are async iterables!\nconst chunks = await concat(fs.createReadStream('./test.txt'))\n\n// chunks is a Uint8ArrayList\nconsole.log(chunks)\n/*\nUint8ArrayList {\n  _bufs: [ <Uint8Array 48 65 6c 6c 6f 20 57 6f 72 6c 64 21> ],\n  length: 12\n}\n*/\nconsole.log(toString(chunks.subarray)))\n// Hello World!\n```\n\nConcat Uint8Arrays to a single *string*:\n\n```js\nimport concat from 'it-concat'\nimport fs from 'fs'\n\nfs.writeFileSync('./test.txt', 'Hello World!')\n\n// Node.js Readable Streams are async iterables!\n// Note that we pass `{ type: 'string' }` to tell concat that we want a string\n// back and not a Uint8Array. This is necessary because the source data is Uint8Array(s).\nconst chunks = await concat(fs.createReadStream('./test.txt'), { type: 'string' })\n\nconsole.log(chunks)\n// Hello World!\n```\n\nConcat strings to a single string:\n\n```js\nimport concat from 'it-concat'\nimport fs from 'fs'\n\nfs.writeFileSync('./test.txt', 'Hello World!')\n\n// Node.js Readable Streams are async iterables!\n// Note that we don't need to pass `{ type: 'string' }` to tell concat that we\n// want a string back because the source data is Uint8Array(s).\nconst chunks = await concat(fs.createReadStream('./test.txt', { encoding: 'utf8' }))\n\nconsole.log(chunks)\n// Hello World!\n```\n\n## API\n\n```js\nimport concat from 'it-concat'\n```\n\n### `concat(source, options?): Promise`\n\nConcat all Uint8Arrays or strings yielded from the async iterable `source` into a single [`Uint8ArrayList`](https://www.npmjs.com/package/bl) or `string`.\n\n- `source` (`AsyncIterable<Uint8Array | Uint8ArrayList | string>`) - the source iterable to concat from\n- `options` (`Object`) - optional options\n- `options.type` (`string`) - return type of the function, pass `'string'` to recieve a string or `'Uint8Array'` for a `Uint8ArrayList`.\n\nReturns a `Promise` that resolves to a `Uint8ArrayList` or `string`.\n\nIf `options.type` is *not* passed the type of the objects yielded from the `source` is detected and a `Uint8ArrayList` or `string` is returned appropriately. If the `source` does not yield anything an empty `Uint8ArrayList` is returned. If the source is expected to return strings (but may not yield anything), pass `options.type: 'string'` to ensure an empty string is returned instead of an empty `Uint8ArrayList`.\n\n## Related\n\n- [`stream-to-it`](https://www.npmjs.com/package/stream-to-it) Convert Node.js streams to streaming iterables\n- [`it-pipe`](https://www.npmjs.com/package/it-pipe) Utility to \"pipe\" async iterables together\n\n[List of awesome modules for working with async iterables](https://github.com/alanshaw/it-awesome).\n\n# License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](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":1666113826431,"_cnpm_publish_time":1666113826431,"dist-tags":{"latest":"3.0.3"}}