{
  "manifest": {
    "name": "data-urls",
    "description": "Parses data: URLs",
    "keywords": [
      "data url",
      "data uri",
      "data:",
      "http",
      "fetch",
      "whatwg"
    ],
    "version": "2.0.0",
    "author": {
      "name": "Domenic Denicola",
      "email": "d@domenic.me",
      "url": "https://domenic.me/"
    },
    "license": "MIT",
    "repository": {
      "type": "git",
      "url": "https://github.com/jsdom/data-urls.git"
    },
    "main": "lib/parser.js",
    "files": [
      "lib/"
    ],
    "scripts": {
      "test": "jest",
      "coverage": "jest --coverage",
      "lint": "eslint .",
      "pretest": "node scripts/get-latest-platform-tests.js"
    },
    "dependencies": {
      "abab": "^2.0.3",
      "whatwg-mimetype": "^2.3.0",
      "whatwg-url": "^8.0.0"
    },
    "devDependencies": {
      "eslint": "^6.8.0",
      "jest": "^24.9.0",
      "request": "^2.88.0"
    },
    "engines": {
      "node": ">=10"
    },
    "jest": {
      "coverageDirectory": "coverage",
      "coverageReporters": [
        "lcov",
        "text-summary"
      ],
      "testEnvironment": "node",
      "testMatch": [
        "<rootDir>/test/**/*.js"
      ],
      "coveragePathIgnorePatterns": [
        "<rootDir>/node_modules/(?!(abab/lib/atob.js))"
      ]
    },
    "_registry": "npm",
    "_loc": "/homez.1033/heliovt/.cache/yarn/v6/npm-data-urls-2.0.0-156485a72963a970f5d5821aaf642bef2bf2db9b-integrity/node_modules/data-urls/package.json",
    "readmeFilename": "README.md",
    "readme": "# Parse `data:` URLs\n\nThis package helps you parse `data:` URLs [according to the WHATWG Fetch Standard](https://fetch.spec.whatwg.org/#data-urls):\n\n```js\nconst parseDataURL = require(\"data-urls\");\n\nconst textExample = parseDataURL(\"data:,Hello%2C%20World!\");\nconsole.log(textExample.mimeType.toString()); // \"text/plain;charset=US-ASCII\"\nconsole.log(textExample.body.toString());     // \"Hello, World!\"\n\nconst htmlExample = dataURL(\"data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E\");\nconsole.log(htmlExample.mimeType.toString()); // \"text/html\"\nconsole.log(htmlExample.body.toString());     // <h1>Hello, World!</h1>\n\nconst pngExample = parseDataURL(\"data:image/png;base64,iVBORw0KGgoAAA\" +\n                                \"ANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4\" +\n                                \"//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU\" +\n                                \"5ErkJggg==\");\nconsole.log(pngExample.mimeType.toString()); // \"image/png\"\nconsole.log(pngExample.body);                // <Buffer 89 50 4e 47 0d ... >\n```\n\n## API\n\nThis package's main module's default export is a function that accepts a string and returns a `{ mimeType, body }` object, or `null` if the result cannot be parsed as a `data:` URL.\n\n- The `mimeType` property is an instance of [whatwg-mimetype](https://www.npmjs.com/package/whatwg-mimetype)'s `MIMEType` class.\n- The `body` property is a Node.js [`Buffer`](https://nodejs.org/docs/latest/api/buffer.html) instance.\n\nAs shown in the examples above, both of these have useful `toString()` methods for manipulating them as string values. However…\n\n### A word of caution on string decoding\n\nBecause Node.js's `Buffer.prototype.toString()` assumes a UTF-8 encoding, simply doing `dataURL.body.toString()` may not work correctly if the `data:` URL's contents were not originally written in UTF-8. This includes if the encoding is \"US-ASCII\", [aka windows-1252](https://encoding.spec.whatwg.org/#names-and-labels), which is notable for being the default in many cases.\n\nA more complete decoding example would use the [whatwg-encoding](https://www.npmjs.com/package/whatwg-encoding) package as follows:\n\n```js\nconst parseDataURL = require(\"data-urls\");\nconst { labelToName, decode } = require(\"whatwg-encoding\");\n\nconst dataURL = parseDataURL(arbitraryString);\nconst encodingName = labelToName(dataURL.mimeType.parameters.get(\"charset\"));\nconst bodyDecoded = decode(dataURL.body, encodingName);\n```\n\nFor example, given an `arbitraryString` of `data:,Hello!`, this will produce a `bodyDecoded` of `\"Hello!\"`, as expected. But given an `arbitraryString` of `\"data:,Héllo!\"`, this will correctly produce a `bodyDecoded` of `\"Héllo!\"`, whereas just doing `dataURL.body.toString()` will give back `\"HÃ©llo!\"`.\n\nIn summary, only use `dataURL.body.toString()` when you are very certain your data is inside the ASCII range (i.e. code points within the range U+0000 to U+007F).\n\n### Advanced functionality: parsing from a URL record\n\nIf you are using the [whatwg-url](https://github.com/jsdom/whatwg-url) package, you may already have a \"URL record\" object on hand, as produced by that package's `parseURL` export. In that case, you can use this package's `fromURLRecord` export to save a bit of work:\n\n```js\nconst { parseURL } = require(\"whatwg-url\");\nconst dataURLFromURLRecord = require(\"data-urls\").fromURLRecord;\n\nconst urlRecord = parseURL(\"data:,Hello%2C%20World!\");\nconst dataURL = dataURLFromURLRecord(urlRecord);\n```\n\nIn practice, we expect this functionality only to be used by consumers like [jsdom](https://www.npmjs.com/package/jsdom), which are using these packages at a very low level.\n",
    "licenseText": "Copyright © 2017–2020 Domenic Denicola <d@domenic.me>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  "artifacts": [],
  "remote": {
    "resolved": "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b",
    "type": "tarball",
    "reference": "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz",
    "hash": "156485a72963a970f5d5821aaf642bef2bf2db9b",
    "integrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==",
    "registry": "npm",
    "packageName": "data-urls",
    "cacheIntegrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ== sha1-FWSFpyljqXD11YIar2Qr7yvy25s="
  },
  "registry": "npm",
  "hash": "156485a72963a970f5d5821aaf642bef2bf2db9b"
}