{"name":"data-uri-to-buffer","version":"8.0.0","type":"module","description":"Create an ArrayBuffer instance from a Data URI string","exports":{"node":{"types":"./dist/node.d.ts","default":"./dist/node.js"},"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"repository":{"type":"git","url":"git+https://github.com/TooTallNate/proxy-agents.git","directory":"packages/data-uri-to-buffer"},"engines":{"node":">= 20"},"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/node":"^22.13.0","typescript":"^5.1.6","tsconfig":"0.0.0"},"scripts":{"build":"tsc","test":"vitest","lint":"eslint . --ext .ts","pack":"node ../../scripts/pack.mjs"},"_id":"data-uri-to-buffer@8.0.0","bugs":{"url":"https://github.com/TooTallNate/proxy-agents/issues"},"homepage":"https://github.com/TooTallNate/proxy-agents#readme","_integrity":"sha512-6UHfyCux51b8PTGDgveqtz1tvphBku5DrMKKJbFAZAJOI2zsjDpDoYE1+QGj7FOMS4BdTFNJsJiR3zEB0xH0yQ==","_resolved":"/tmp/205b1ad854a9feadc72bb1f4bce43537/data-uri-to-buffer-8.0.0.tgz","_from":"file:data-uri-to-buffer-8.0.0.tgz","_nodeVersion":"20.20.1","_npmVersion":"11.12.1","dist":{"integrity":"sha512-6UHfyCux51b8PTGDgveqtz1tvphBku5DrMKKJbFAZAJOI2zsjDpDoYE1+QGj7FOMS4BdTFNJsJiR3zEB0xH0yQ==","shasum":"c642ffbc96d8fae76cccecbad43cbddd7818c785","tarball":"http://registry-npm.ywwl.com/data-uri-to-buffer/download/data-uri-to-buffer-8.0.0.tgz","fileCount":15,"unpackedSize":14776,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/data-uri-to-buffer@8.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFqxBtDCqHYnVUcOODx1SSbFHUafFnNJqo8UyJ+C+B0pAiBLARD8SJsOY9txQmyUAjz16IPbTDmt38k/6c++0T+Prg=="}],"size":4871,"noattachment":false,"key":"/data-uri-to-buffer/-/data-uri-to-buffer-8.0.0.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:42565514-968b-4724-a547-9b317c5d9bfb"}},"directories":{},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/data-uri-to-buffer_8.0.0_1775026656987_0.5139888183195218"},"_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":1775026657124,"_cnpm_publish_time":1775026657124,"dist-tags":{"latest":"8.0.0"}}