{"_id":"file-source","_rev":"3001245","name":"file-source","description":"Read binary files in chunks, on demand, with promises.","dist-tags":{"latest":"0.6.1"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"time":{"modified":"2023-08-29T08:56:47.000Z","created":"2016-08-31T20:38:03.990Z","0.6.1":"2016-09-07T22:05:06.254Z","0.6.0":"2016-09-07T17:15:42.993Z","0.5.0":"2016-09-06T18:13:31.627Z","0.4.0":"2016-09-02T22:01:33.527Z","0.3.0":"2016-09-02T00:18:17.418Z","0.2.0":"2016-09-01T18:48:10.176Z","0.1.1":"2016-09-01T18:23:06.989Z","0.1.0":"2016-09-01T17:16:40.803Z","0.0.1":"2016-08-31T20:38:03.990Z"},"users":{},"author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"versions":{"0.6.1":{"name":"file-source","version":"0.6.1","description":"Read binary files in chunks, on demand, with promises.","keywords":["binary","file","reader","fs"],"homepage":"https://github.com/mbostock/file-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"scripts":{"test":"tape 'test/**/*-test.js'","postpublish":"git push && git push --tags"},"dependencies":{"stream-source":"0.3"},"devDependencies":{"tape":"4"},"gitHead":"9e02e3e999c34524b7b60a54480cbf3bed5cad24","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"_id":"file-source@0.6.1","_shasum":"ae189d4993766b865a77f83adcf9b9a504cd37dc","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mbostock","email":"mbostock@gmail.com"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"dist":{"shasum":"ae189d4993766b865a77f83adcf9b9a504cd37dc","size":2506,"noattachment":false,"key":"/file-source/-/file-source-0.6.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-source/download/file-source-0.6.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/file-source-0.6.1.tgz_1473285906002_0.12300366954877973"},"directories":{},"publish_time":1473285906254,"_hasShrinkwrap":false,"_cnpm_publish_time":1473285906254,"_cnpmcore_publish_time":"2021-12-16T19:32:04.464Z"},"0.6.0":{"name":"file-source","version":"0.6.0","description":"Read binary files in chunks, on demand, with promises.","keywords":["binary","file","reader","fs"],"homepage":"https://github.com/mbostock/file-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"scripts":{"test":"tape 'test/**/*-test.js'","postpublish":"git push && git push --tags"},"dependencies":{"stream-source":"0.3"},"devDependencies":{"tape":"4"},"gitHead":"fda76bc5e044810f4ef3d6c51cb5d5922fd1ab36","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"_id":"file-source@0.6.0","_shasum":"90a5634f08bbb116b32c962d0ff908a67da4c7ab","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mbostock","email":"mbostock@gmail.com"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"dist":{"shasum":"90a5634f08bbb116b32c962d0ff908a67da4c7ab","size":2392,"noattachment":false,"key":"/file-source/-/file-source-0.6.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-source/download/file-source-0.6.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/file-source-0.6.0.tgz_1473268540798_0.08217929978854954"},"directories":{},"publish_time":1473268542993,"_hasShrinkwrap":false,"_cnpm_publish_time":1473268542993,"_cnpmcore_publish_time":"2021-12-16T19:32:04.659Z"},"0.5.0":{"name":"file-source","version":"0.5.0","description":"Read binary files in chunks, on demand, with promises.","keywords":["binary","file","reader","fs"],"homepage":"https://github.com/mbostock/file-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"scripts":{"test":"tape 'test/**/*-test.js'","postpublish":"git push && git push --tags"},"dependencies":{"stream-source":"0.2"},"devDependencies":{"tape":"4"},"gitHead":"c3ad38d3354f0236bf97e0f273880abe05024747","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"_id":"file-source@0.5.0","_shasum":"5bf05172152c8cebb76c77ca08ae3621bae9dac2","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mbostock","email":"mbostock@gmail.com"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"dist":{"shasum":"5bf05172152c8cebb76c77ca08ae3621bae9dac2","size":2969,"noattachment":false,"key":"/file-source/-/file-source-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-source/download/file-source-0.5.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/file-source-0.5.0.tgz_1473185609845_0.468941441969946"},"directories":{},"publish_time":1473185611627,"_hasShrinkwrap":false,"_cnpm_publish_time":1473185611627,"_cnpmcore_publish_time":"2021-12-16T19:32:04.901Z"},"0.4.0":{"name":"file-source","version":"0.4.0","description":"Read binary files in chunks, on demand, with promises.","keywords":["binary","file","reader","fs"],"homepage":"https://github.com/mbostock/file-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"scripts":{"test":"tape 'test/**/*-test.js'","postpublish":"git push && git push --tags"},"devDependencies":{"tape":"4"},"gitHead":"dae312864e8cc994e1d5a1dc09a36ef580dad36b","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"_id":"file-source@0.4.0","_shasum":"fffed4ce2996d1ad50b36c474eae1b6a189c82bf","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mbostock","email":"mbostock@gmail.com"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"dist":{"shasum":"fffed4ce2996d1ad50b36c474eae1b6a189c82bf","size":9221,"noattachment":false,"key":"/file-source/-/file-source-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-source/download/file-source-0.4.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/file-source-0.4.0.tgz_1472853693279_0.9794310184661299"},"directories":{},"publish_time":1472853693527,"_hasShrinkwrap":false,"_cnpm_publish_time":1472853693527,"_cnpmcore_publish_time":"2021-12-16T19:32:05.093Z"},"0.3.0":{"name":"file-source","version":"0.3.0","description":"Read binary files in chunks, on demand, with promises.","keywords":["binary","file","reader","fs"],"homepage":"https://github.com/mbostock/file-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"scripts":{"test":"tape 'test/**/*-test.js'","postpublish":"git push && git push --tags"},"devDependencies":{"tape":"4"},"gitHead":"b5c4a1318f3548ec97e2a9401e5e3cca2d60b1cd","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"_id":"file-source@0.3.0","_shasum":"7034ecab232abb4ed66b4ab31a5800b719cffff3","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mbostock","email":"mbostock@gmail.com"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"dist":{"shasum":"7034ecab232abb4ed66b4ab31a5800b719cffff3","size":9046,"noattachment":false,"key":"/file-source/-/file-source-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-source/download/file-source-0.3.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/file-source-0.3.0.tgz_1472775494010_0.5422270519193262"},"directories":{},"publish_time":1472775497418,"_hasShrinkwrap":false,"_cnpm_publish_time":1472775497418,"_cnpmcore_publish_time":"2021-12-16T19:32:05.312Z"},"0.2.0":{"name":"file-source","version":"0.2.0","description":"Read binary files.","keywords":["binary","file","reader","fs"],"homepage":"https://github.com/mbostock/file-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"scripts":{"test":"tape 'test/**/*-test.js'","postpublish":"git push && git push --tags"},"devDependencies":{"tape":"4"},"gitHead":"d393e5b4a3df236e222d1c1fa22cbda27f0cf706","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"_id":"file-source@0.2.0","_shasum":"ffda655e9501b1f6cb2836d41ff6aaa559fb0920","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mbostock","email":"mbostock@gmail.com"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"dist":{"shasum":"ffda655e9501b1f6cb2836d41ff6aaa559fb0920","size":7937,"noattachment":false,"key":"/file-source/-/file-source-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-source/download/file-source-0.2.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/file-source-0.2.0.tgz_1472755686788_0.4383212262764573"},"directories":{},"publish_time":1472755690176,"_hasShrinkwrap":false,"_cnpm_publish_time":1472755690176,"_cnpmcore_publish_time":"2021-12-16T19:32:05.551Z"},"0.1.1":{"name":"file-source","version":"0.1.1","description":"Read binary files.","keywords":["binary","file","reader","fs"],"homepage":"https://github.com/mbostock/file-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"scripts":{"test":"tape 'test/**/*-test.js'"},"devDependencies":{"tape":"4"},"gitHead":"4f11330e9794262b945eaaa10e66aebfe8bd15ff","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"_id":"file-source@0.1.1","_shasum":"5407ca982e689ff4ea5bba9468a1d3aad5df2304","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mbostock","email":"mbostock@gmail.com"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"dist":{"shasum":"5407ca982e689ff4ea5bba9468a1d3aad5df2304","size":7557,"noattachment":false,"key":"/file-source/-/file-source-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-source/download/file-source-0.1.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/file-source-0.1.1.tgz_1472754186752_0.6445263680070639"},"directories":{},"publish_time":1472754186989,"_hasShrinkwrap":false,"_cnpm_publish_time":1472754186989,"_cnpmcore_publish_time":"2021-12-16T19:32:05.773Z"},"0.1.0":{"name":"file-source","version":"0.1.0","description":"Read binary files.","keywords":["binary","file","reader","fs"],"homepage":"https://github.com/mbostock/file-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"scripts":{"test":"tape 'test/**/*-test.js'"},"devDependencies":{"tape":"4"},"gitHead":"20cc262f26ee7c05f748dec7d2b27f9f3716d4ce","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"_id":"file-source@0.1.0","_shasum":"8df3c72e659797de256f98ee7319804c0061bb01","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mbostock","email":"mbostock@gmail.com"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"dist":{"shasum":"8df3c72e659797de256f98ee7319804c0061bb01","size":5860,"noattachment":false,"key":"/file-source/-/file-source-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-source/download/file-source-0.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/file-source-0.1.0.tgz_1472750197629_0.0393613267224282"},"directories":{},"publish_time":1472750200803,"_hasShrinkwrap":false,"_cnpm_publish_time":1472750200803,"_cnpmcore_publish_time":"2021-12-16T19:32:05.995Z"},"0.0.1":{"name":"file-source","version":"0.0.1","description":"Read binary files.","keywords":["binary","file","reader","fs"],"homepage":"https://github.com/mbostock/file-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/file-source.git"},"scripts":{"test":"tape 'test/**/*-test.js'"},"devDependencies":{"tape":"4"},"gitHead":"fd9cc5127ad0a2f0fc24f8f9a95999953cfc3912","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"_id":"file-source@0.0.1","_shasum":"017a3c5cea2a2db6ce59999124d91be645981f70","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"mbostock","email":"mbostock@gmail.com"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"dist":{"shasum":"017a3c5cea2a2db6ce59999124d91be645981f70","size":2917,"noattachment":false,"key":"/file-source/-/file-source-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-source/download/file-source-0.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/file-source-0.0.1.tgz_1472675883756_0.79424406029284"},"directories":{},"publish_time":1472675883990,"_hasShrinkwrap":false,"_cnpm_publish_time":1472675883990,"_cnpmcore_publish_time":"2021-12-16T19:32:06.225Z"}},"readme":"# file-source\n\nA [sliceable](https://github.com/mbostock/slice-source), [readable stream reader](https://streams.spec.whatwg.org/#readable-stream-reader) implementation on top of a Node [file read stream](https://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options). This library allows you to write code that takes a *source* as input, and can work with either native readable streams or Node streams. For example:\n\n```js\nvar file = require(\"file-source\");\n\nfile(\"README.md\")\n  .then(function read(source) {\n    return source.slice(40).then(value => {\n      if (value == null) return;\n      process.stdout.write(value);\n      return read(source);\n    });\n  })\n  .catch(error => console.error(error.stack));\n```\n\n## API Reference\n\n<a name=\"file\" href=\"#file\">#</a> <b>file</b>(<i>path</i>[, <i>options</i>]) [<>](https://github.com/mbostock/file-source/blob/master/index.js \"Source\")\n\nReturns a Promise that yields a *source* for the file at the specified *path* when the underlying file is open. The following options are allowed:\n\n* `highWaterMark` - the stream’s internal buffer size; defaults to 65,536\n\n<a name=\"source_slice\" href=\"#source_slice\">#</a> <i>source</i>.<b>slice</b>(<i>length</i>) [<>](https://github.com/mbostock/stream-source/blob/master/slice.js \"Source\")\n\nReturns a Promise for the next chunk of data from the underlying stream, yielding a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) (a [Buffer](https://nodejs.org/api/buffer.html)) of *length* bytes, or the remaining bytes of the underlying stream if the underlying stream has more than zero but fewer than *length* bytes remaining, or null when no bytes remain in the stream.\n\n<a name=\"source_read\" href=\"#source_read\">#</a> <i>source</i>.<b>read</b>() [<>](https://github.com/mbostock/stream-source/blob/master/read.js \"Source\")\n\nReturns a Promise for the next chunk of data from the underlying stream. The yielded result is an object with the following properties:\n\n* `value` - a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) (a [Buffer](https://nodejs.org/api/buffer.html)), or undefined if the stream ended\n* `done` - a boolean which is true if the stream ended\n\n<a name=\"source_cancel\" href=\"#source_cancel\">#</a> <i>source</i>.<b>cancel</b>() [<>](https://github.com/mbostock/slice-source/blob/master/cancel.js \"Source\")\n\nReturns a Promise which is resolved when the underlying stream has been destroyed.\n","_attachments":{},"homepage":"https://github.com/mbostock/file-source","bugs":{"url":"https://github.com/mbostock/file-source/issues"},"license":"BSD-3-Clause"}