{"name":"it-reader","version":"5.0.2","description":"Read an exact number of bytes from a binary (async) iterable","author":{"name":"Alan Shaw"},"license":"Apache-2.0 OR MIT","homepage":"https://github.com/alanshaw/it-reader#readme","repository":{"type":"git","url":"git+https://github.com/alanshaw/it-reader.git"},"bugs":{"url":"https://github.com/alanshaw/it-reader/issues"},"keywords":["async","binary","buffer","it","iterable","iterator","read","stream"],"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":{"clean":"aegir clean","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":{"it-stream-types":"^1.0.4","uint8arraylist":"^1.2.0"},"devDependencies":{"aegir":"^37.4.7","iso-random-stream":"^2.0.2"},"gitHead":"ab306c75c2df44b22abe9ef8ee6fc89d90c826a3","_id":"it-reader@5.0.2","_nodeVersion":"16.16.0","_npmVersion":"8.15.1","dist":{"integrity":"sha512-OgcWA/ffAALrkuUN2sQsbKa3of5oOyLvlXJgSCZdn9sSLZ0rnNmtsJ3lP/WEfWJH8aUNs3bfG6ja3QXKcCOwFw==","shasum":"4a146cf418bc564995b8d0a9a7f4bbd7299f5011","tarball":"http://registry-npm.ywwl.com/it-reader/download/it-reader-5.0.2.tgz","fileCount":8,"unpackedSize":11842,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID/elsZtyFgEYhBo1Mk6S2XfgBdwkJTIleZwJnNCUssmAiEA0igigF9NgpzI2QzZOqBGNBq79iw7zDhfYzNwZUVQhKc="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi4sJXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq5Fg/9EhkjbkqZub5iUg2HG51NzcXsFNitVqxA41x4p4dl4x9Si9cP\r\nnK64F8yNhEXcR3BN6zrAPvrlc32HWs8hL2KnCJp/oZA27gRSyOmxBg93Gdsc\r\n4zTwKS+Vrm2y2agZf5gjfE6K+Ix6esDrkUYbudd3Ef3Ih8ki3s3xNy2O5t+r\r\n+N/HlhoIgRBI8ZxoF3blRF0ieNkls3DXJ8tLSc5/v8MGHp9Wm5C2BjShcc8m\r\nBbvF5pV8bUgtrXhmMn3dnJ1mcvP76yVo9zQAlI324afzzySIKKzJIEmPfeFH\r\npiOR1SOrVSsy+z5hQN9lTgQ2W9HeNSHfCxuhO0d75K03eW/CP3bB7URPkDrh\r\nBijw2kBqM+IlbtKJMBG6DbU5m1xsp3pOgpzWO6hbMNC+I5AUyqq4p8x7Y7WV\r\nDZQqC41V7bjdYXcE11QTwhdj02MA3spMVv/++OWWIq5ei7JW3oyW05+oxMs3\r\nVm+r19Zgg5cSsZArg+BscQEJO+PvpP++M1T31kOQ0b3Pp7pHJIP+oU5E3KJI\r\nBqM2t0pq9PWeUnB1FuuM5exmlPYcIla9kvwqkNRM5HXDAH+DpFvaU1J/I+AY\r\nB+N+6EupI+7F+84GdtPyhUIZfzeHPYnyl+u0BaCyk56Wpx26iLM/SKicYeLP\r\nLvqY7oBq2Ho54YnFcbqmHjXt3zEo3/uyGl8=\r\n=L6Ok\r\n-----END PGP SIGNATURE-----\r\n","size":3820,"noattachment":false,"key":"/it-reader/-/it-reader-5.0.2.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-reader_5.0.2_1659028055202_0.1569444758037588"},"_hasShrinkwrap":false,"readme":"# it-reader <!-- omit in toc -->\n\n[![codecov](https://img.shields.io/codecov/c/github/alanshaw/it-reader.svg?style=flat-square)](https://codecov.io/gh/alanshaw/it-reader)\n[![CI](https://img.shields.io/github/actions/workflow/status/alanshaw/it-reader/js-test-and-release.yml?branch=master\\&style=flat-square)](https://github.com/alanshaw/it-reader/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n> Read an exact number of bytes from a binary (async) iterable\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n  - [Browser `<script>` tag](#browser-script-tag)\n- [Usage](#usage)\n- [API](#api)\n  - [`reader(source)`](#readersource)\n    - [Parameters](#parameters)\n    - [Returns](#returns)\n- [Contribute](#contribute)\n- [API Docs](#api-docs)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Install\n\n```console\n$ npm i it-reader\n```\n\n### Browser `<script>` tag\n\nLoading this module through a script tag will make it's exports available as `ItReader` in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/it-reader/dist/index.min.js\"></script>\n```\n\n## Usage\n\n```js\nimport { reader } from 'it-reader'\n\nconst stream = reader(source) // source is any iterable or async iterable\nconst { value, done } = await stream.next(8)\n\n// NOTE: value is a BufferList (https://npm.im/bl)\nconsole.log(value.toString())\n\n// Now read 16 more bytes:\nawait stream.next(16)\n\n// or...\n// Consume the rest of the stream\n\nfor await (const chunk of stream) {\n  console.log(chunk.toString())\n}\n```\n\n## API\n\n```js\nimport { reader } from 'it-reader'\n```\n\n### `reader(source)`\n\nCreate and return a new reader.\n\n#### Parameters\n\n- `source` (`Iterable`) - An [iterable or async iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) that yields [`Buffer`](https://npm.im/buffer) or [`BufferList`](https://npm.im/bl) objects.\n\n#### Returns\n\nAn [async iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol) that yields [`BufferList`](https://npm.im/bl) objects.\n\nThe iterator's `next` method takes an *optional* parameter - the number of bytes to read from the `source`.\n\nIf the number of bytes to read are not specified, the iterator will yield any bytes remaining in the internal buffer or the next available chunk.\n\nIf the number of bytes to read exceeds the number of bytes available in the source the iterator will throw and error with a `code` property set to `'ERR_UNDER_READ'` and a `buffer` property (the bytes read so far, if any), which is a [`BufferList`](https://npm.im/bl) instance.\n\n## Contribute\n\nFeel free to dive in! [Open an issue](https://github.com/alanshaw/it-reader/issues/new) or submit PRs.\n\n## API Docs\n\n- <https://alanshaw.github.io/it-reader>\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":1659028055386,"_cnpm_publish_time":1659028055386,"dist-tags":{"latest":"7.0.0"}}