{"_id":"path-source","_rev":"3001257","name":"path-source","description":"Read files in Node, or fetch URLs in browser, as standard WhatWG streams.","dist-tags":{"latest":"0.1.3"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"time":{"modified":"2023-08-29T08:56:50.000Z","created":"2016-09-06T21:14:42.607Z","0.1.3":"2017-09-02T22:06:05.776Z","0.1.2":"2016-09-07T23:29:09.979Z","0.1.1":"2016-09-07T22:07:23.220Z","0.1.0":"2016-09-07T17:31:05.644Z","0.0.2":"2016-09-06T23:15:30.569Z","0.0.1":"2016-09-06T21:14:42.607Z"},"users":{},"author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/path-source.git"},"versions":{"0.1.3":{"name":"path-source","version":"0.1.3","description":"Read files in Node, or fetch URLs in browser, as standard WhatWG streams.","keywords":["fetch","stream","reader"],"homepage":"https://github.com/mbostock/path-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"unpkg":"dist/path-source.js","jsdelivr":"dist/path-source.js","main":"index.node.js","module":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/path-source.git"},"scripts":{"prepublishOnly":"rm -rf dist && mkdir dist && rollup -c --banner \"$(preamble)\" && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" -o dist/path-source.min.js -c -m -- dist/path-source.js","postpublish":"git push && git push --tags"},"dependencies":{"array-source":"0.0","file-source":"0.6"},"devDependencies":{"package-preamble":"0.1","rollup":"0.49","uglify-js":"3"},"gitHead":"be74516a063fac30bc2c98813a050603dc6111a7","bugs":{"url":"https://github.com/mbostock/path-source/issues"},"_id":"path-source@0.1.3","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"mbostock","email":"mike@ocks.org"},"dist":{"shasum":"03907c595480aa2596a15a901c44f745736e7a73","size":3617,"noattachment":false,"key":"/path-source/-/path-source-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-source/download/path-source-0.1.3.tgz"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/path-source-0.1.3.tgz_1504389965691_0.7300573014654219"},"directories":{},"publish_time":1504389965776,"_hasShrinkwrap":false,"_cnpm_publish_time":1504389965776,"_cnpmcore_publish_time":"2021-12-16T19:31:58.941Z"},"0.1.2":{"name":"path-source","version":"0.1.2","description":"Read files in Node, or fetch URLs in browser, as standard WhatWG streams.","keywords":["fetch","stream","reader"],"homepage":"https://github.com/mbostock/path-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"browser":"dist/path-source.js","main":"index.node.js","module":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/path-source.git"},"scripts":{"prepublish":"rm -rf dist && mkdir dist && rollup --banner \"$(preamble)\" -f umd -g array-source:sources.array -n sources.path -o dist/path-source.js -- index.js && uglifyjs --preamble \"$(preamble)\" -o dist/path-source.min.js -cm -- dist/path-source.js","postpublish":"git push && git push --tags"},"dependencies":{"array-source":"0.0","file-source":"0.6"},"devDependencies":{"package-preamble":"0.0","rollup":"0.34","uglify-js":"2"},"gitHead":"9e7cdf9726d0eeb39f2704db32e56fbdfc10470b","bugs":{"url":"https://github.com/mbostock/path-source/issues"},"_id":"path-source@0.1.2","_shasum":"c5a26c44fb92cd32b930e8e49b1fe5750f2ca70b","_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":"c5a26c44fb92cd32b930e8e49b1fe5750f2ca70b","size":3483,"noattachment":false,"key":"/path-source/-/path-source-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-source/download/path-source-0.1.2.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/path-source-0.1.2.tgz_1473290949729_0.9380144476890564"},"directories":{},"publish_time":1473290949979,"_hasShrinkwrap":false,"_cnpm_publish_time":1473290949979,"_cnpmcore_publish_time":"2021-12-16T19:31:59.128Z"},"0.1.1":{"name":"path-source","version":"0.1.1","description":"Read files in Node, or fetch URLs in browser, as standard WhatWG streams.","keywords":["fetch","stream","reader"],"homepage":"https://github.com/mbostock/path-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"browser":"dist/path-source.js","main":"index.node.js","module":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/path-source.git"},"scripts":{"prepublish":"rm -rf dist && mkdir dist && rollup --banner \"$(preamble)\" -f umd -g array-source:sources.array -n sources.path -o dist/path-source.js -- index.js && uglifyjs --preamble \"$(preamble)\" -o dist/path-source.min.js -cm -- dist/path-source.js","postpublish":"git push && git push --tags"},"dependencies":{"array-source":"0.0","file-source":"0.6"},"devDependencies":{"package-preamble":"0.0","rollup":"0.34","uglify-js":"2"},"gitHead":"090ac8e4237242b3636e790d9bfe5da6699c6cdd","bugs":{"url":"https://github.com/mbostock/path-source/issues"},"_id":"path-source@0.1.1","_shasum":"c9a3389d7cb4417128d4fc7de805dc3c849e94d4","_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":"c9a3389d7cb4417128d4fc7de805dc3c849e94d4","size":3479,"noattachment":false,"key":"/path-source/-/path-source-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-source/download/path-source-0.1.1.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/path-source-0.1.1.tgz_1473286040785_0.7509122078772634"},"directories":{},"publish_time":1473286043220,"_hasShrinkwrap":false,"_cnpm_publish_time":1473286043220,"_cnpmcore_publish_time":"2021-12-16T19:31:59.339Z"},"0.1.0":{"name":"path-source","version":"0.1.0","description":"Read files in Node, or fetch URLs in browser, as standard WhatWG streams.","keywords":["fetch","stream","reader"],"homepage":"https://github.com/mbostock/path-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"browser":"dist/path-source.js","main":"index.node.js","module":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/path-source.git"},"scripts":{"prepublish":"rm -rf dist && mkdir dist && rollup --banner \"$(preamble)\" -f umd -g array-source:sources.array -n sources.path -o dist/path-source.js -- index.js && uglifyjs --preamble \"$(preamble)\" -o dist/path-source.min.js -cm -- dist/path-source.js","postpublish":"git push && git push --tags"},"dependencies":{"array-source":"0.0","file-source":"0.6"},"devDependencies":{"package-preamble":"0.0","rollup":"0.34","uglify-js":"2"},"gitHead":"ce12b1e9d9c1ca7f9710f98aadec7e05af42d9f3","bugs":{"url":"https://github.com/mbostock/path-source/issues"},"_id":"path-source@0.1.0","_shasum":"d36e26f58fb12af2e44c3ba951501abf19253261","_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":"d36e26f58fb12af2e44c3ba951501abf19253261","size":3392,"noattachment":false,"key":"/path-source/-/path-source-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-source/download/path-source-0.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/path-source-0.1.0.tgz_1473269465413_0.19910506112501025"},"directories":{},"publish_time":1473269465644,"_hasShrinkwrap":false,"_cnpm_publish_time":1473269465644,"_cnpmcore_publish_time":"2021-12-16T19:31:59.555Z"},"0.0.2":{"name":"path-source","version":"0.0.2","description":"Read files in Node, or fetch URLs in browser, as standard WhatWG streams.","keywords":["fetch","stream","reader"],"homepage":"https://github.com/mbostock/path-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"browser":"dist/path-source.js","main":"index.node.js","module":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/path-source.git"},"scripts":{"prepublish":"rm -rf dist && mkdir dist && rollup --banner \"$(preamble)\" -f umd -g array-source:sources.array,slice-source:sources.slice -n sources.path -o dist/path-source.js -- index.js && uglifyjs --preamble \"$(preamble)\" -o dist/path-source.min.js -cm -- dist/path-source.js","postpublish":"git push && git push --tags"},"devDependencies":{"package-preamble":"0.0","rollup":"0.34","uglify-js":"2"},"dependencies":{"array-source":"0.0","file-source":"0.5","slice-source":"0.3"},"gitHead":"7b473040812c45db51c95a1ea6605a333ba746b7","bugs":{"url":"https://github.com/mbostock/path-source/issues"},"_id":"path-source@0.0.2","_shasum":"a9b0ba1355074a2e8b02ed7af1a3b2b06a874b82","_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":"a9b0ba1355074a2e8b02ed7af1a3b2b06a874b82","size":4020,"noattachment":false,"key":"/path-source/-/path-source-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-source/download/path-source-0.0.2.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/path-source-0.0.2.tgz_1473203728594_0.4285888886079192"},"directories":{},"publish_time":1473203730569,"_hasShrinkwrap":false,"_cnpm_publish_time":1473203730569,"_cnpmcore_publish_time":"2021-12-16T19:31:59.727Z"},"0.0.1":{"name":"path-source","version":"0.0.1","description":"Read files in Node, or fetch URLs in browser, as standard WhatWG streams.","keywords":["fetch","stream","reader"],"homepage":"https://github.com/mbostock/path-source","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"https://bost.ocks.org/mike"},"browser":"dist/path-source.js","main":"index.node.js","module":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mbostock/path-source.git"},"scripts":{"prepublish":"rm -rf dist && mkdir dist && rollup --banner \"$(preamble)\" -f umd -g array-source:sources.array -n sources.path -o dist/path-source.js -- index.js && uglifyjs --preamble \"$(preamble)\" -o dist/path-source.min.js -cm -- dist/path-source.js","postpublish":"git push && git push --tags"},"devDependencies":{"package-preamble":"0.0","rollup":"0.34","uglify-js":"2"},"dependencies":{"array-source":"0.0","file-source":"0.5"},"gitHead":"ecfbbdab341710c0bbcdd13ee3ecc8e282ecdec5","bugs":{"url":"https://github.com/mbostock/path-source/issues"},"_id":"path-source@0.0.1","_shasum":"26dd2c164d7eaf2222fa81c132ab6c4195c1fc96","_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":"26dd2c164d7eaf2222fa81c132ab6c4195c1fc96","size":3816,"noattachment":false,"key":"/path-source/-/path-source-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-source/download/path-source-0.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/path-source-0.0.1.tgz_1473196482372_0.946271708002314"},"directories":{},"publish_time":1473196482607,"_hasShrinkwrap":false,"_cnpm_publish_time":1473196482607,"_cnpmcore_publish_time":"2021-12-16T19:31:59.899Z"}},"readme":"# path-source\n\nA [readable stream reader](https://streams.spec.whatwg.org/#readable-stream-reader) for reading files in Node or fetching URLs in browser. For example, to read a file in Node:\n\n```js\nvar path = require(\"path-source\");\n\npath(\"README.md\")\n  .then(function read(source) {\n    return source.read().then(result => {\n      if (result.done) return;\n      process.stdout.write(result.value);\n      return read(source);\n    });\n  })\n  .catch(error => console.error(error.stack));\n```\n\nSimilarly, to fetch a resource in a browser (requires [array-source](https://github.com/mbostock/array-source) if [streaming fetch](https://www.chromestatus.com/feature/5804334163951616) is not supported):\n\n```html\n<!DOCTYPE html>\n<script src=\"https://unpkg.com/array-source@0\"></script>\n<script src=\"https://unpkg.com/path-source@0\"></script>\n<script>\n\nsources.path(\"README.md\")\n  .then(function read(source) {\n    return source.read().then(result => {\n      if (result.done) return;\n      console.log(result.value);\n      return read(source);\n    });\n  })\n  .catch(error => console.error(error.stack));\n\n</script>\n```\n\n## API Reference\n\n<a name=\"path\" href=\"#path\">#</a> <b>path</b>(<i>path</i>[, <i>options</i>]) [<>](https://github.com/mbostock/path-source/blob/master/index.js \"Source\")\n\nIn Node, returns a Promise that yields a *source* for the file at the specified *path*; equivalent to [file-source](https://github.com/mbostock/file-source#file). In a browser, returns a Promise that yields a *source* for the resource at the specified *path* URL, using [streaming fetch](https://www.chromestatus.com/feature/5804334163951616) if available, and falling back to a [binary data](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data) [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest).\n\nIn Node, the following options are supported:\n\n* `highWaterMark` - the stream’s internal buffer size; defaults to 65,536\n\nIn a browser, no options are currently supported.\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/path-source","bugs":{"url":"https://github.com/mbostock/path-source/issues"},"license":"BSD-3-Clause"}