{"name":"data-uri-to-buffer","version":"5.0.0","description":"Generate a Buffer instance from a Data URI string","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc","test":"jest --env node --verbose --bail","lint":"eslint . --ext .ts","pack":"node ../../scripts/pack.mjs"},"repository":{"type":"git","url":"git+https://github.com/TooTallNate/proxy-agents.git","directory":"packages/data-uri-to-buffer"},"engines":{"node":">= 14"},"keywords":["data","uri","datauri","data-uri","buffer","convert","rfc2397","2397"],"author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io/"},"license":"MIT","devDependencies":{"@types/jest":"^27.0.2","@types/node":"^14.18.43","jest":"^29.5.0","ts-jest":"^29.1.0","tsconfig":"workspace:*","typescript":"^5.0.4"},"gitHead":"4d75e6cc974b2614a575e6f7a3d3c79741727dbc","bugs":{"url":"https://github.com/TooTallNate/proxy-agents/issues"},"homepage":"https://github.com/TooTallNate/proxy-agents#readme","_id":"data-uri-to-buffer@5.0.0","_nodeVersion":"16.20.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-RqYkPrQOBOGLS/OYpNwPuoyYvjKFmCePfA8SOrbCd1ohhtGNT/GSheWZzNTJlPvUWQYI9N4bcM0wbsp08AJyWw==","shasum":"7b4e06b6292a279401c8868c047329f5d42c54ad","tarball":"http://registry-npm.ywwl.com/data-uri-to-buffer/download/data-uri-to-buffer-5.0.0.tgz","fileCount":7,"unpackedSize":10163,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKt4vn5uG2MGQzK26j3FJPBSZSl6kJ2mhNrpyuWzJWagIhAMInB+sxcgQwZbSCwQMH09X8SzWXwEtG8/0RNYJPV+01"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkVBaPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrUCg//QYUFmz2mPuHhnTS2GmBol90DkqMsd4L4TaqnvwjnUOg6+IBi\r\nBSRXkTFKEObucIibTbvHnRtCHFmE950iTF7gSj7IHMaDMlQe1brCbzrfxUqL\r\njeDQfiOF1yM1k2xMoRwXZYTyXLZGj4Ony94iZrh1IbbXymUCh2pBbdFN4Us6\r\n/oEPWuXRe7VtN+TaGm56M2rugsaE3VSRskssmqC+DpNxkIPmKcTzi2sGs8aU\r\nk2k5vsr8mrKmavBIkcbfhqCbXU+ps/ShE0iN6oy/xDPboz8ehrfWXhgWaIJ6\r\nOl8c4Ta/ykE7qUmM8Pb3f9Q5mqEf6HUlIUydolSN+abdZT67biMQagnnCwNJ\r\nrRdt7duwH4lTedk0LmiM7n/cd+KPzaFd0krggPlXp6V7Js4Eijr4kkkQ+gF3\r\nOMZ7J6IwE+6UBPdod03bpDa3I86ffY9qnm0jy4Zg7medKwSHfhqA4eGMbqDZ\r\nVN884tFmgZHP0XhDpcvltC2Uh1ODDAdlhe7FFMTSLPavKz6fEv9/Q9QYz1Wm\r\ngJUnU+urPVf7zm54MSgruQWAioiKzt7CqHZlyUxGTI7fQUViwo/WtD1wg1+X\r\nOOM3qGxr3qeUlJQaQz9i9hNVj0HBr+CSccghmBewg6z9w/xZ/etHWz1bUAne\r\nS2cAHoBv3l+pXQxL3BkI7v8kT0dqf+kKbBo=\r\n=rlgJ\r\n-----END PGP SIGNATURE-----\r\n","size":3472,"noattachment":false,"key":"/data-uri-to-buffer/-/data-uri-to-buffer-5.0.0.tgz"},"_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"directories":{},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/data-uri-to-buffer_5.0.0_1683232399483_0.4102046430354689"},"_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":1683232399663,"_cnpm_publish_time":1683232399663,"dist-tags":{"latest":"8.0.0"}}