{"name":"data-uri-to-buffer","version":"6.0.2","description":"Create an ArrayBuffer instance from a Data URI string","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{"node":"./dist/node.js","default":"./dist/index.js"},"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.45","jest":"^29.5.0","ts-jest":"^29.1.0","typescript":"^5.0.4","tsconfig":"0.0.0"},"scripts":{"build":"tsc","test":"jest --env node --verbose --bail","lint":"eslint . --ext .ts","pack":"node ../../scripts/pack.mjs"},"bugs":{"url":"https://github.com/TooTallNate/proxy-agents/issues"},"homepage":"https://github.com/TooTallNate/proxy-agents#readme","_id":"data-uri-to-buffer@6.0.2","_integrity":"sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==","_resolved":"/tmp/fb3865a21fe72e0dc250a7262903a94e/data-uri-to-buffer-6.0.2.tgz","_from":"file:data-uri-to-buffer-6.0.2.tgz","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==","shasum":"8a58bb67384b261a38ef18bea1810cb01badd28b","tarball":"http://registry-npm.ywwl.com/data-uri-to-buffer/download/data-uri-to-buffer-6.0.2.tgz","fileCount":16,"unpackedSize":16799,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRRrwO+BS1tCn0U6jL1RKkjkALy0vPnMA5m9jKvkOIEgIhALe4GtXXnoFrnEKrvzC/29aAmCi97lfoV050TkdlB6Dt"}],"size":5039,"noattachment":false,"key":"/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.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_6.0.2_1707762257392_0.9218302669200353"},"_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":1707762257563,"_cnpm_publish_time":1707762257563,"dist-tags":{"latest":"8.0.0"}}