{"name":"data-uri-to-buffer","version":"4.0.0","description":"Generate a Buffer instance from a Data URI string","type":"module","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"jest","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git://github.com/TooTallNate/node-data-uri-to-buffer.git"},"engines":{"node":">= 12"},"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/es6-promisify":"^5.0.0","@types/mocha":"^9.0.0","@types/node":"^10.5.3","jest":"^27.2.2","ts-jest":"^27.0.5","typescript":"^4.4.3"},"jest":{"preset":"ts-jest","globals":{"ts-jest":{"diagnostics":false,"isolatedModules":true}},"verbose":false,"testEnvironment":"node","testMatch":["<rootDir>/test/**/*.test.ts"]},"gitHead":"099460306e59ee2cbd9117e2b430e808ad19f5c0","_id":"data-uri-to-buffer@4.0.0","_nodeVersion":"12.22.6","_npmVersion":"7.24.1","dist":{"integrity":"sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==","shasum":"b5db46aea50f6176428ac05b73be39a57701a64b","tarball":"http://registry-npm.ywwl.com/data-uri-to-buffer/download/data-uri-to-buffer-4.0.0.tgz","fileCount":12,"unpackedSize":26622,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2nsvCRA9TVsSAnZWagAAEd0QAIAzsqr1kzx5nbU8Kvi1\naNsqZbjjZVH24bwHcP9TWnyeNJiUC4dlnTRq0IElEWBUrU9FqSclAeVX7WM6\ns1KQJxLt7JgGcksc5USgckAWf6E2O7xFcRrVH6fNBvGW0GFTmQFDCc3yE+oS\nFTJtVwUSGYRcHG7DHsYTDDvJqUem2hoz1P/LLuwTizji1QIZAOZBpNYeo5/j\n/dU/FFGp1vSUMHORbgOR/hm9Ck8aWEx44z3DX+NFYubNdxEnhwgpZICcr2ql\niYrR1HeENjsKOWVBrF3DdiC+r+hCTSRlcNAzOF3x9COoqEfG8fp9Nz8U7lWY\najYK5AWe0C1CpjhSqbk23lQbYfL9tN8ootDJszmJzjs62YdrIR+T+TDmgsC6\notvJlgLJnQULBs91OWmx0I5vJWI5eeEzA2zhn121ZlvsTkTb9nkC/isAW8k0\n0k2/CP5W9vGC2no/iGE6+qfsGBMPlCm6c9OuOU3vWbj3DA5lSp2+Fx7LZHXj\nkJB6lxQmkDsiFgzUDZFtqfJ102mm2SukcOTq0uEh49IsFYC0xSPbMQa3Ls+a\n8YScQLKdy/ZLm3rIJN2w4fJw6TcN7haNTnREfsx8MLRS7cHt4YeJKUj7x6lm\ntmf8Pj56pB04KsCi1+EPN933rEEm60PKLudF3F3A5WvXenqZZQ2yGimf4l2l\nOwHH\r\n=7c9v\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFNMvE6i9iZGHi5EaFkKRrUsPpI4WtMvoQYQMmiAgbEjAiBPERt61ldHdwa5XUX4rnRokYytneFjK5bY33o5aDKkJw=="}],"size":5677,"noattachment":false,"key":"/data-uri-to-buffer/-/data-uri-to-buffer-4.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_4.0.0_1632737498941_0.6380803188362318"},"_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":1632737499112,"_cnpm_publish_time":1632737499112,"dist-tags":{"latest":"8.0.0"}}