{"name":"d3-fetch","version":"1.0.1","description":"Convenient parsing for Fetch.","keywords":["d3","d3-module","fetch","ajax","XMLHttpRequest"],"homepage":"https://d3js.org/d3-fetch/","license":"BSD-3-Clause","author":{"name":"Mike Bostock","url":"http://bost.ocks.org/mike"},"main":"dist/d3-fetch.js","module":"index.js","repository":{"type":"git","url":"git+https://github.com/d3/d3-fetch.git"},"scripts":{"pretest":"rm -rf dist && mkdir dist && rollup -c --banner \"$(preamble)\"","test":"tape 'test/**/*-test.js'","prepublishOnly":"npm run test && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" dist/d3-fetch.js -c -m -o dist/d3-fetch.min.js","postpublish":"git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-fetch/dist/d3-fetch.js d3-fetch.v1.js && cp ../d3-fetch/dist/d3-fetch.min.js d3-fetch.v1.min.js && git add d3-fetch.v1.js d3-fetch.v1.min.js && git commit -m \"d3-fetch ${npm_package_version}\" && git push && cd - && zip -j dist/d3-fetch.zip -- LICENSE README.md dist/d3-fetch.js dist/d3-fetch.min.js"},"dependencies":{"d3-dsv":"1"},"devDependencies":{"eslint":"4","package-preamble":"0.1","rollup":"0.52","tape":"4","uglify-js":"3.2"},"gitHead":"90769c21be0909575a8ca1f9c418714540d7b6be","bugs":{"url":"https://github.com/d3/d3-fetch/issues"},"_id":"d3-fetch@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"mbostock","email":"mike@ocks.org"},"dist":{"integrity":"sha512-RMOMgHre3TMqICRGZ9EWHm00IK6Tw810F98fnbZKb7855jrEXVvg/h8O/cz7GN5tzRjc65tNNhQMfg0rgCu/XA==","shasum":"177e1538511b2d0356a9bb076dd60955692280ae","tarball":"http://registry-npm.ywwl.com/d3-fetch/download/d3-fetch-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAv3k9M/AY1DurP1prdopK4olsiZ9UTwpLUZgcBNrj5BAiAFq0vPk2Qe1TbuebrJFVSbCqBQu55cDydASJJeoFtDKg=="}],"size":4762,"noattachment":false,"key":"/d3-fetch/-/d3-fetch-1.0.1.tgz"},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/d3-fetch-1.0.1.tgz_1517195401090_0.49150442401878536"},"directories":{},"readme":"# d3-fetch\n\nThis module provides convenient parsing on top of [Fetch](https://fetch.spec.whatwg.org/). For example, to load a text file:\n\n```js\nconst text = await d3.text(\"/path/to/file.txt\");\nconsole.log(text); // Hello, world!\n```\n\nTo load and parse a CSV file:\n\n```js\nconst data = await d3.csv(\"/path/to/file.csv\");\nconsole.log(data); // [{\"Hello\": \"world\"}, …]\n```\n\nThis module has built-in support for parsing [JSON](#json), [CSV](#csv), and [TSV](#tsv). You can parse additional formats by using [text](#text) directly. (This module replaced [d3-request](https://github.com/d3/d3-request).)\n\n## Installing\n\nIf you use npm, `npm install d3-fetch`. You can also download the [latest release on GitHub](https://github.com/d3/d3-fetch/releases/latest). For vanilla HTML in modern browsers, import d3-fetch from Skypack:\n\n```html\n<script type=\"module\">\n\nimport {csv} from \"https://cdn.skypack.dev/d3-fetch@3\";\n\ncsv(\"/path/to/file.csv\").then((data) => {\n  console.log(data); // [{\"Hello\": \"world\"}, …]\n});\n\n</script>\n```\n\nFor legacy environments, you can load d3-fetch’s UMD bundle from an npm-based CDN such as jsDelivr; a `d3` global is exported:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/d3-fetch@3\"></script>\n<script>\n\nd3.csv(\"/path/to/file.csv\").then((data) => {\n  console.log(data); // [{\"Hello\": \"world\"}, …]\n});\n\n</script>\n```\n\n## API Reference\n\n<a name=\"blob\" href=\"#blob\">#</a> d3.<b>blob</b>(<i>input</i>[, <i>init</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/blob.js \"Source\")\n\nFetches the binary file at the specified *input* URL as a Blob. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields.\n\n<a name=\"buffer\" href=\"#buffer\">#</a> d3.<b>buffer</b>(<i>input</i>[, <i>init</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/buffer.js \"Source\")\n\nFetches the binary file at the specified *input* URL as an ArrayBuffer. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields.\n\n<a name=\"csv\" href=\"#csv\">#</a> d3.<b>csv</b>(<i>input</i>[, <i>init</i>][, <i>row</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/dsv.js \"Source\")\n\nEquivalent to [d3.dsv](#dsv) with the comma character as the delimiter.\n\n<a name=\"dsv\" href=\"#dsv\">#</a> d3.<b>dsv</b>(<i>delimiter</i>, <i>input</i>[, <i>init</i>][, <i>row</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/dsv.js \"Source\")\n\nFetches the [DSV](https://github.com/d3/d3-dsv) file at the specified *input* URL. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields. An optional *row* conversion function may be specified to map and filter row objects to a more-specific representation; see [*dsv*.parse](https://github.com/d3/d3-dsv#dsv_parse) for details. For example:\n\n```js\nconst data = await d3.dsv(\",\", \"test.csv\", (d) => {\n  return {\n    year: new Date(+d.Year, 0, 1), // convert \"Year\" column to Date\n    make: d.Make,\n    model: d.Model,\n    length: +d.Length // convert \"Length\" column to number\n  };\n});\n```\n\nIf only one of *init* and *row* is specified, it is interpreted as the *row* conversion function if it is a function, and otherwise an *init* object.\n\nSee also [d3.csv](#csv) and [d3.tsv](#tsv).\n\n<a name=\"html\" href=\"#html\">#</a> d3.<b>html</b>(<i>input</i>[, <i>init</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/xml.js \"Source\")\n\nFetches the file at the specified *input* URL as [text](#text) and then [parses it](https://developer.mozilla.org/docs/Web/API/DOMParser) as HTML. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields.\n\n<a name=\"image\" href=\"#image\">#</a> d3.<b>image</b>(<i>input</i>[, <i>init</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/image.js \"Source\")\n\nFetches the image at the specified *input* URL. If *init* is specified, sets any additional properties on the image before loading. For example, to enable an anonymous [cross-origin request](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image):\n\n```js\nconst img = await d3.image(\"https://example.com/test.png\", {crossOrigin: \"anonymous\"});\n```\n\n<a name=\"json\" href=\"#json\">#</a> d3.<b>json</b>(<i>input</i>[, <i>init</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/json.js \"Source\")\n\nFetches the [JSON](http://json.org) file at the specified *input* URL. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields. If the server returns a status code of [204 No Content](https://developer.mozilla.org/docs/Web/HTTP/Status/204) or [205 Reset Content](https://developer.mozilla.org/docs/Web/HTTP/Status/205), the promise resolves to `undefined`.\n\n<a name=\"svg\" href=\"#svg\">#</a> d3.<b>svg</b>(<i>input</i>[, <i>init</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/xml.js \"Source\")\n\nFetches the file at the specified *input* URL as [text](#text) and then [parses it](https://developer.mozilla.org/docs/Web/API/DOMParser) as SVG. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields.\n\n<a name=\"text\" href=\"#text\">#</a> d3.<b>text</b>(<i>input</i>[, <i>init</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/text.js \"Source\")\n\nFetches the text file at the specified *input* URL. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields.\n\n<a name=\"tsv\" href=\"#tsv\">#</a> d3.<b>tsv</b>(<i>input</i>[, <i>init</i>][, <i>row</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/dsv.js \"Source\")\n\nEquivalent to [d3.dsv](#dsv) with the tab character as the delimiter.\n\n<a name=\"xml\" href=\"#xml\">#</a> d3.<b>xml</b>(<i>input</i>[, <i>init</i>]) · [Source](https://github.com/d3/d3-fetch/blob/master/src/xml.js \"Source\")\n\nFetches the file at the specified *input* URL as [text](#text) and then [parses it](https://developer.mozilla.org/docs/Web/API/DOMParser) as XML. If *init* is specified, it is passed along to the underlying call to [fetch](https://fetch.spec.whatwg.org/#fetch-method); see [RequestInit](https://fetch.spec.whatwg.org/#requestinit) for allowed fields.\n","publish_time":1517195401180,"_cnpm_publish_time":1517195401180,"dist-tags":{"latest":"3.0.2"}}