{"name":"d3-fetch","version":"3.0.1","description":"Convenient parsing for Fetch.","homepage":"https://d3js.org/d3-fetch/","repository":{"type":"git","url":"git+https://github.com/d3/d3-fetch.git"},"keywords":["d3","d3-module","fetch","ajax","XMLHttpRequest"],"license":"ISC","author":{"name":"Mike Bostock","url":"http://bost.ocks.org/mike"},"type":"module","module":"src/index.js","main":"src/index.js","jsdelivr":"dist/d3-fetch.min.js","unpkg":"dist/d3-fetch.min.js","exports":{"umd":"./dist/d3-fetch.min.js","default":"./src/index.js"},"sideEffects":false,"dependencies":{"d3-dsv":"1 - 3"},"devDependencies":{"eslint":"7","mocha":"8","rollup":"2","rollup-plugin-terser":"7"},"scripts":{"test":"mocha 'test/**/*-test.js' && eslint src test","prepublishOnly":"rm -rf dist && yarn test && rollup -c","postpublish":"git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd -"},"engines":{"node":">=12"},"gitHead":"20a0b61b87a55c88e6b83580c927523b5c0448fe","bugs":{"url":"https://github.com/d3/d3-fetch/issues"},"_id":"d3-fetch@3.0.1","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==","shasum":"83141bff9856a0edb5e38de89cdcfe63d0a60a22","tarball":"http://registry-npm.ywwl.com/d3-fetch/download/d3-fetch-3.0.1.tgz","fileCount":13,"unpackedSize":16419,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgu8OmCRA9TVsSAnZWagAANDkP/3Oi5ry84ccq2klkURzs\nX/T8QVDf2k9iLKauJ08AUWLJjlQYbA/hAf4Sl4EyvL3iwSRqGTscKApNH2vj\nZu/rwnqfMiHdkmErLioNMIqV1Q2pikhskMT4gaEu+JyPovs6H2iXa0ACdeTf\n3dyJgS6FqPKwy+nPnuJRid6OAsXGvp1TcDZdzg+nD7yCaHthBeEpzMym7N0d\nR5VTcWl+woMCjSrRZvkKBNrBS/ZANCiyRPX8K1fJOZodEjVSj2LkWZbwNJbT\ndm8r2B0W5prvsF6oj6Py7BsisBjaFdKMdfQToRf/1pP/kNOdlqzoQmGSHnnl\nElh15F6wenrpEJvRl2IV1HnFQi9w7GoRRpWuiIXZOW5TksGsmb0cIOMxVZwe\nu8M5LvbjQBnwkdgrUDosn38NdD5KfWQxHq2XvmlN8YUDE1DsJHTwKARlf4Xh\nzabtNxKLhbn09BC0uumprc2Q1df9yEDDvlk79Wzt9EFqdWyDrvBq/LaBQQ0q\naocGxtxOJJ8ElZEvZGnv6gtr5SA97fQL71ae2D+f8fntagnd5gkDa9wKuMrY\n+KHD2jN96MxwqSqbZddohD84oLaLld/mm0y2J7UjuskMBGxMfkdJYN9b6YA/\n9KgwSVYgNeii0EZlkAo3bNU17PuY+WIs2l2cQmD/w1rMHXV8BSAyb6MqSlt8\nwTjb\r\n=Qz2w\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDRIIHUUJxWIbvPK7lusu9gLNeAj2PRCPkkWrHhFUziAIgECnLKCsUzGy2tkz7dHNFK+h7CShWSCaEnbYPggYkBK8="}],"size":4735,"noattachment":false,"key":"/d3-fetch/-/d3-fetch-3.0.1.tgz"},"_npmUser":{"name":"mbostock","email":"mike@ocks.org"},"directories":{},"maintainers":[{"name":"mbostock","email":"mike@ocks.org"},{"name":"recifs","email":"fil@rezo.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/d3-fetch_3.0.1_1622918054083_0.6839276150726885"},"_hasShrinkwrap":false,"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":1622918054207,"_cnpm_publish_time":1622918054207,"dist-tags":{"latest":"3.0.2"}}