{"name":"@hapi/ammo","description":"HTTP Range processing utilities","version":"3.1.2","repository":{"type":"git","url":"git://github.com/hapijs/ammo.git"},"main":"lib/index.js","keywords":["http","range","utilities"],"dependencies":{"@hapi/hoek":"8.x.x"},"devDependencies":{"@hapi/code":"6.x.x","@hapi/lab":"20.x.x","@hapi/wreck":"15.x.x"},"scripts":{"test":"lab -a @hapi/code -t 100 -L","test-cov-html":"lab -a @hapi/code -r html -o coverage.html"},"license":"BSD-3-Clause","readme":"<a href=\"http://hapijs.com\"><img src=\"https://raw.githubusercontent.com/hapijs/assets/master/images/family.png\" width=\"180px\" align=\"right\" /></a>\n\n# ammo\n\nHTTP Range processing utilities.\n\n[![Build Status](https://secure.travis-ci.org/hapijs/ammo.png)](http://travis-ci.org/hapijs/ammo)\n\n## Usage\n\n```js\n// basic usage\nconst range = Ammo.header('bytes=1-5', 10);\n// range --> [{ from: 1, to: 5 }]\n\n// multiple ranges\nconst range = Ammo.header('bytes=1-5,7-10', 10);\n// range --> [{ from: 1, to: 5 }, { from: 7, to: 9 }]\n\n// streams (get range within a `source`)\nconst range = Ammo.header('bytes=1000-4000', 5000);\nconst stream = new Ammo.Stream(range[0]);\nconst buffer = await Wreck.read(source.pipe(stream));\n\n// buffer is the portion of source within range\n```\n\n## API\n\n### `header(header, length)`\n\nParses the range from a HTTP header.\n\n* `header` - A string in the form of `bytes=from-to`, where `from` and `to` are\nintegers specifying the range. Both are optional. Multiple ranges can be passed\nas a comma delimited list.\n* `length` - A positive integer specifying the maximum length the range can\ncover. If a `to` value passed in the `header` string is greater than `length`,\nthe `to` value is set as `length - 1`.\n\nReturns an array of objects with the properties `from` and `to`, which specify\nthe beginning and ending of the range. Overlapping ranges are combined into one\nobject. Returns `null` for invalid input.\n\n### `new Ammo.Stream(range)`\n\nCreates a [`Transform Stream`](https://nodejs.org/api/stream.html) that extracts\nthe portion of a piped in stream within `range`.\n* `range` - an object with the properties `from` and `to` that specify the range\nof the piped in stream to read. Objects returned by `Ammo.header` can be passed\ninto `range`.\n","readmeFilename":"README.md","gitHead":"a6d67a49c80bd183df450292e64462a0daaab778","bugs":{"url":"https://github.com/hapijs/ammo/issues"},"homepage":"https://github.com/hapijs/ammo#readme","_id":"@hapi/ammo@3.1.2","_nodeVersion":"13.7.0","_npmVersion":"6.13.7","_npmUser":{"name":"hueniverse","email":"eran@hammer.io"},"dist":{"integrity":"sha512-ej9OtFmiZv1qr45g1bxEZNGyaR4jRpyMxU6VhbxjaYThymvOwsyIsUKMZnP5Qw2tfYFuwqCJuIBHGpeIbdX9gQ==","shasum":"a9edf5d48d99b75fdcd7ab3dabf9059942a06961","tarball":"http://registry-npm.ywwl.com/@hapi/ammo/download/@hapi/ammo-3.1.2.tgz","fileCount":6,"unpackedSize":8160,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeRN7pCRA9TVsSAnZWagAANegP/jGkeSnzFKvjTnrao+Tz\n7rmMuqnDhUBkezKj6pj52lMDETABc6iytt4MRA7Lv4k7TOmBAy+VSlnx/r7e\nYV9ONFhx+NBl4CgRgNK6JklWWtY+rEwhZkWfH6aIMRpY9VnQxAAB+hFh2dcv\nQrL0YkJiIr4N36iGoO3rTTh+oS2uUcJPT2jbVvKxIl3KBVAppYt7Ja371pyK\nijPx2N7kAGC63RCj4WCwgvFNidcl0MvuG9bkzvvYTvlR2TMrE4EcAtG9O7b0\nlUldDNAJqgR6cXdMT8ZIU5aIT2n7f4ztanPqadG5WtCKhZo+be32Q3XlzgQK\npZw8cWAXx2Rg/d5YBjutoy/7PFaflMcCQ7VfSzW5EnBMTRdyw4M5K8gzEd6+\n+cLlfm02W61/yQFqSejSxXwBZ5lPTGOpsZ8fxsvbP9BIVqhbeILKs5Su8gaD\n6lq52wUd34o/FHA88DxFPpN5wt/abXuDuSMZOL2oPEGVa6KuhMhr9u0oAIOu\n482Ck34VHFi0MeuhpyZ9c56kcHF23naphtenPTM8f81IK699G4Ux7A0WJMA7\nU9y8Z5PkA5Q4qIKWpCjN8iIdiXPWTSIrbqCoCMqH8ZAlQNkttxQSt6qkwFc2\nkO/i+kqgs7eRhRnrnKa2blVWiFnPSc9bT46CRl5nlsQAO22jati+8IF0s7BO\nSCAs\r\n=z3WW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5ZA292i9GvttojPbtp09OJoHb3VSrV7QhP0oTQvmiLAIgHJB8d5qhBQUQ9OwW7X4i9JdY5OmVnAgvAEN7LqNrxzA="}],"size":3592,"noattachment":false,"key":"/@hapi/ammo/-/@hapi/ammo-3.1.2.tgz"},"maintainers":[{"email":"eran@hammer.io","name":"hueniverse"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ammo_3.1.2_1581571816734_0.9905677269110729"},"_hasShrinkwrap":false,"deprecated":"This version has been deprecated and is no longer supported or maintained","publish_time":1581571816907,"_cnpm_publish_time":1581571816907,"dist-tags":{"latest":"6.0.2","lts":"3.1.2"}}