{"name":"data-uri-to-buffer","version":"2.0.1","description":"Generate a Buffer instance from a Data URI string","main":"index.js","types":"index.d.ts","scripts":{"test":"mocha --reporter spec"},"repository":{"type":"git","url":"git://github.com/TooTallNate/node-data-uri-to-buffer.git"},"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","dependencies":{"@types/node":"^8.0.7"},"devDependencies":{"mocha":"^3.4.2"},"gitHead":"84d6d828d8eaca38813c8ba7f11607fa558b7b2f","_id":"data-uri-to-buffer@2.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"dist":{"integrity":"sha512-OkVVLrerfAKZlW2ZZ3Ve2y65jgiWqBKsTfUIAFbn8nVbPcCZg6l6gikKlEYv0kXcmzqGm6mFq/Jf2vriuEkv8A==","shasum":"ca8f56fe38b1fd329473e9d1b4a9afcd8ce1c045","tarball":"http://registry-npm.ywwl.com/data-uri-to-buffer/download/data-uri-to-buffer-2.0.1.tgz","fileCount":7,"unpackedSize":13318,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcpk2bCRA9TVsSAnZWagAA0gYP/ifvuWGpnTvukeCbzuAz\nUEx3+usgqDqgXQBRyBt/IKOGvf+QzB4FZdNSZrwx7TVFC6l6wOSrEK9MnYUf\nsLtgkazKK79h2KA/4dM3rL0qKAVEw0460hM1wx3Nsmd2of6MbcUf3wyMicbp\nsbr6sVLAMhb//hDrIlhK8F3ic/cKwSvr2bywZ5TBpOW7qOvj8g2n1dachCGN\nWTogiJe9kixB+MNt+l162b9jr/tYGNepWosFK8BuI7RleWcBVsMlsntogJlp\ngHml5TA0UzRQkSrFQXLgct1tLh3VwYcLrlt5fEBTVVLLBwGp2qOpywqFf8Qg\nXQ+YZu1FnBKvQbrfypJWW5iMjLzgaEp47RzywHUhm+We74UzZ0407ilzJLGR\nTdXCw9n/muWGCEPUvG+ZAiOD7aTowUrSdvCks2/Y9gp6pXD4ERY+8ujyiMdr\nQxO3mrPs0pVTZ+aUaAy5LYeSskoxBvS1r6QZ/YL+6Pw4L+QeRNPhVZyNzmS3\nq2/hBYQf/ighzrpojzMT8Smp3If1Vp4vrFahLpVpo502SHWLcblxsKBg3Lgn\nyPy2EajwxtbSJ0+7tYUsfes2JuOAgQTrw2JPfW9WBT1TMCH7wz+5ITsP1gmP\nNwlkxnN6Oj0xDdk69jnQaJmipm2Ay8mYTArPAhxwDGIq8hF/rVsh5O84kuLj\nIfYE\r\n=aVCV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCdTte8tGge5lq+ha1xwlQdL1kmsO9R0a2OwGQhNCNp9gIhAO80bfYflSUyfbAhFGxvgxEulB5fILRiposJZIZT0CWT"}],"size":4407,"noattachment":false,"key":"/data-uri-to-buffer/-/data-uri-to-buffer-2.0.1.tgz"},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/data-uri-to-buffer_2.0.1_1554402714500_0.7907742068800752"},"_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":1554402714601,"_cnpm_publish_time":1554402714601,"dist-tags":{"latest":"8.0.0"}}