{"name":"data-uri-to-buffer","version":"4.0.1","description":"Generate a Buffer instance from a Data URI string","type":"module","exports":"./dist/index.js","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/jest":"^27.0.2","@types/node":"^12.20.36","jest":"^27.3.1","ts-jest":"^27.0.7","typescript":"^4.4.4"},"jest":{"preset":"ts-jest","globals":{"ts-jest":{"diagnostics":false,"isolatedModules":true}},"verbose":false,"testEnvironment":"node","testMatch":["<rootDir>/test/**/*.test.ts"]},"gitHead":"85cd8c854aefbf1bb636789d80364cfac8ea1583","_id":"data-uri-to-buffer@4.0.1","_nodeVersion":"16.18.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==","shasum":"d8feb2b2881e6a4f58c2e08acfd0e2834e26222e","tarball":"http://registry-npm.ywwl.com/data-uri-to-buffer/download/data-uri-to-buffer-4.0.1.tgz","fileCount":6,"unpackedSize":10049,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB8aF0pXlnwJZiGMoMGmXhPR+2h2Tkzq9N7In8oH37z6AiEAlBfobbDNJtTxMBDTaJ2ox0kSO3yvaNzS+StuDuythUA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwKoQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqPZxAAhSSUvsUlqSLH3I5/sCG2JgnzGNJ4Nu53GptVmWBh473olUtW\r\n15C1IahGUqMn/tu/lMgpmoMS7i9PNx6lkKABQyGQMoTIT5qlZ+4y6eGbS0eK\r\nEiofd9FZDbP3K9mUNpBk8oudK2Onp7L8z6c4K9pFEbHBIzNeUp3Q8dMY5LK4\r\nu5Ruq2U52AQrk8h2BSVkXjhGdJW9saEtbx17OIO1G3CcIxK4KVwjrg/59nV9\r\neY60Ba2Z+vxmByrycZJFtXiwTmj+lACTY6WQKN5LKoL9Jmfwtv7ouAwwWlkD\r\n0btf8CyGtgU20705j/OjVnKdp7yJyrzRNsRAMXX4iAGCA0sFn+ddwYTCb8sd\r\n16idSDog1GR4WLhwsfOrdouJy4qTi4vBYj//wa+jfF8kkaDwVv6i0wQ3kx6L\r\n3COFNtpKd6Jdw8kwCeBKfT5H0Bp/5Ws4iWQ/ObxV5cfhMM46k1uIz/qMeYXH\r\nG1PV3+Im4sTKsyhh07+raP5wvPSrEQqqdVdkIXKIlwLvW2CRex7K8NUn9dkn\r\n845cYU26vNXBSrboL6Hkr+uOMoZCn+nrpErbLk69/A+qmkRIxSQ2uvkZGY2M\r\n9d5R8WbQ+EqqiUdAlhQuX+ol0kWtAxB69pDNrHOqhnaWBLxEbM/o3Y6JXpNM\r\n7P5aJmNwCf4A2HJWAk7keW3m6BhKU4Sbl0E=\r\n=PPVo\r\n-----END PGP SIGNATURE-----\r\n","size":3680,"noattachment":false,"key":"/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.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.1_1673570832777_0.48692261036527995"},"_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":1673570832963,"_cnpm_publish_time":1673570832963,"dist-tags":{"latest":"8.0.0"}}