{"name":"data-uri-to-buffer","version":"2.0.2","description":"Generate a Buffer instance from a Data URI string","main":"index.js","types":"index.d.ts","scripts":{"test":"mocha --reporter spec"},"repository":{"type":"git","url":"git://github.com/TooTallNate/node-data-uri-to-buffer.git"},"keywords":["data","uri","datauri","data-uri","buffer","convert","rfc2397","2397"],"author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io/"},"license":"MIT","bugs":{"url":"https://github.com/TooTallNate/node-data-uri-to-buffer/issues"},"homepage":"https://github.com/TooTallNate/node-data-uri-to-buffer","devDependencies":{"@types/node":"^8.0.7","mocha":"^3.4.2"},"gitHead":"49ca2a1b68b0080b6e037712a73cb423679a5ec6","_id":"data-uri-to-buffer@2.0.2","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==","shasum":"d296973d5a4897a5dbe31716d118211921f04770","tarball":"http://registry-npm.ywwl.com/data-uri-to-buffer/download/data-uri-to-buffer-2.0.2.tgz","fileCount":7,"unpackedSize":13346,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjSkuCRA9TVsSAnZWagAANxkP/iKIxylFIJEGlZ6AufPN\n9P1Ml1Yz5fRGXS1s0HKtl4eRGfLh0h2bBAGJ5r4P+bKvGaTw010N/3wWHTea\n0ka39AedyeWmIxD0fuHX6lV5yeqwY0rXDcPAR2/DVHG6v7cfxWNbZ7MA3TFo\n6dFJe4bPI3s6Wu7y+S1uuh475oHhZiz1HfuF7rKirkw7biuvVpwaEImcqup6\nL7auRcWEepWooGSOu5Wz1oYEk0umNy1MbH/CuvN6mCgDIoeAmktmgfb7h3LP\n4NHTxpT9Jzv0gla/Tjxbpx881DnN/izR4oVzOncHwTUnjxtpKpNJTDTyLyeJ\n6Gv6Re9duAktMgwsUBGoifhajcBKrEps09PeRRmB1DEaTvzXMwUZhhHA+4Z7\nVkoEmvY/epcY2uvqpsW5x77SCS4fEaOHRPywhBHVk/VarAVuxN5n9Z3P+DTA\nQ18Kun1ut6xg3Au/3mtvB580fbFHadG65aEc54wow4QJphb//IasgyfjSgxK\nPSNG9+bYQEdTHVIwivJv6Pox4CCBR7D34e8QwJpFr8bEqNhjWX7iSpDIAB00\nIWDUtzaH/c9rjsv1ZMjdyiSm4hKP1KGB454l4oqSCsjy7zycX2T+4xgb2lvW\nNDjmiISj8kUmtmMxAWILP1k7ErcrA51TPzzrcH1aiv14JY2T4O2lrM6ucA+y\n4JYZ\r\n=Gs8W\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCluu1MjSY0tma7d/BLSbdYwk76U1MlEzyxyrC04Kc/mwIgMiaJsxDgP0lCD84sBZWYV0HSu0oHJpi+4qemK+j2u6s="}],"size":4422,"noattachment":false,"key":"/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz"},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/data-uri-to-buffer_2.0.2_1569532206206_0.4679690854249954"},"_hasShrinkwrap":false,"readme":"data-uri-to-buffer\n==================\n### Create an ArrayBuffer instance from a [Data URI][rfc] string\n\nThis module accepts a [\"data\" URI][rfc] String of data, and returns\nan `ArrayBuffer` instance with the decoded data.\n\nThis module is intended to work on a large variety of JavaScript\nruntimes, including Node.js and web browsers.\n\nExample\n-------\n\n```typescript\nimport { dataUriToBuffer } from 'data-uri-to-buffer';\n\n// plain-text data is supported\nlet uri = 'data:,Hello%2C%20World!';\nlet parsed = dataUriToBuffer(uri);\nconsole.log(new TextDecoder().decode(parsed.buffer));\n// 'Hello, World!'\n\n// base64-encoded data is supported\nuri = 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D';\nparsed = dataUriToBuffer(uri);\nconsole.log(new TextDecoder().decode(parsed.buffer));\n// 'Hello, World!'\n```\n\n\nAPI\n---\n\n```typescript\nexport interface ParsedDataURI {\n\ttype: string;\n\ttypeFull: string;\n\tcharset: string;\n\tbuffer: ArrayBuffer;\n}\n```\n\n### dataUriToBuffer(uri: string | URL) → ParsedDataURI\n\nThe `type` property gets set to the main type portion of\nthe \"mediatype\" portion of the \"data\" URI, or defaults to `\"text/plain\"` if not\nspecified.\n\nThe `typeFull` property gets set to the entire\n\"mediatype\" portion of the \"data\" URI (including all parameters), or defaults\nto `\"text/plain;charset=US-ASCII\"` if not specified.\n\nThe `charset` property gets set to the Charset portion of\nthe \"mediatype\" portion of the \"data\" URI, or defaults to `\"US-ASCII\"` if the\nentire type is not specified, or defaults to `\"\"` otherwise.\n\n*Note*: If only the main type is specified but not the charset, e.g.\n`\"data:text/plain,abc\"`, the charset is set to the empty string. The spec only\ndefaults to US-ASCII as charset if the entire type is not specified.\n\n[rfc]: http://tools.ietf.org/html/rfc2397\n","publish_time":1569532206304,"_cnpm_publish_time":1569532206304,"dist-tags":{"latest":"8.0.0"}}