104 lines
5.6 KiB
JSON
104 lines
5.6 KiB
JSON
{
|
||
"_args": [
|
||
[
|
||
{
|
||
"raw": "whatwg-encoding@^1.0.3",
|
||
"scope": null,
|
||
"escapedName": "whatwg-encoding",
|
||
"name": "whatwg-encoding",
|
||
"rawSpec": "^1.0.3",
|
||
"spec": ">=1.0.3 <2.0.0",
|
||
"type": "range"
|
||
},
|
||
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/jsdom"
|
||
]
|
||
],
|
||
"_from": "whatwg-encoding@>=1.0.3 <2.0.0",
|
||
"_id": "whatwg-encoding@1.0.3",
|
||
"_inCache": true,
|
||
"_location": "/whatwg-encoding",
|
||
"_nodeVersion": "8.6.0",
|
||
"_npmOperationalInternal": {
|
||
"host": "s3://npm-registry-packages",
|
||
"tmp": "tmp/whatwg-encoding-1.0.3.tgz_1509241494617_0.47145224804989994"
|
||
},
|
||
"_npmUser": {
|
||
"name": "domenic",
|
||
"email": "d@domenic.me"
|
||
},
|
||
"_npmVersion": "5.4.2",
|
||
"_phantomChildren": {},
|
||
"_requested": {
|
||
"raw": "whatwg-encoding@^1.0.3",
|
||
"scope": null,
|
||
"escapedName": "whatwg-encoding",
|
||
"name": "whatwg-encoding",
|
||
"rawSpec": "^1.0.3",
|
||
"spec": ">=1.0.3 <2.0.0",
|
||
"type": "range"
|
||
},
|
||
"_requiredBy": [
|
||
"/html-encoding-sniffer",
|
||
"/jsdom"
|
||
],
|
||
"_resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz",
|
||
"_shasum": "57c235bc8657e914d24e1a397d3c82daee0a6ba3",
|
||
"_shrinkwrap": null,
|
||
"_spec": "whatwg-encoding@^1.0.3",
|
||
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/jsdom",
|
||
"author": {
|
||
"name": "Domenic Denicola",
|
||
"email": "d@domenic.me",
|
||
"url": "https://domenic.me/"
|
||
},
|
||
"bugs": {
|
||
"url": "https://github.com/jsdom/whatwg-encoding/issues"
|
||
},
|
||
"dependencies": {
|
||
"iconv-lite": "0.4.19"
|
||
},
|
||
"description": "Decode strings according to the WHATWG Encoding Standard",
|
||
"devDependencies": {
|
||
"eslint": "^3.8.0",
|
||
"got": "^6.5.0",
|
||
"mocha": "^3.1.2"
|
||
},
|
||
"directories": {},
|
||
"dist": {
|
||
"integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==",
|
||
"shasum": "57c235bc8657e914d24e1a397d3c82daee0a6ba3",
|
||
"tarball": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz"
|
||
},
|
||
"files": [
|
||
"lib/"
|
||
],
|
||
"gitHead": "04a110a0b202ecf435aacf8617fd4a568e85964e",
|
||
"homepage": "https://github.com/jsdom/whatwg-encoding#readme",
|
||
"keywords": [
|
||
"encoding",
|
||
"whatwg"
|
||
],
|
||
"license": "MIT",
|
||
"main": "lib/whatwg-encoding.js",
|
||
"maintainers": [
|
||
{
|
||
"name": "domenic",
|
||
"email": "d@domenic.me"
|
||
}
|
||
],
|
||
"name": "whatwg-encoding",
|
||
"optionalDependencies": {},
|
||
"readme": "# Decode According to the WHATWG Encoding Standard\n\nThis package provides a thin layer on top of [iconv-lite](https://github.com/ashtuchkin/iconv-lite) which makes it expose some of the same primitives as the [Encoding Standard](https://encoding.spec.whatwg.org/).\n\n```js\nconst whatwgEncoding = require(\"whatwg-encoding\");\n\nconsole.assert(whatwgEncoding.labelToName(\"latin1\") === \"windows-1252\");\nconsole.assert(whatwgEncoding.labelToName(\" CYRILLic \") === \"ISO-8859-5\");\n\nconsole.assert(whatwgEncoding.isSupported(\"IBM866\") === true);\n\n// Not supported by the Encoding Standard\nconsole.assert(whatwgEncoding.isSupported(\"UTF-32\") === false);\n\n// In the Encoding Standard, but this package can't decode it\nconsole.assert(whatwgEncoding.isSupported(\"x-mac-cyrillic\") === false);\n\nconsole.assert(whatwgEncoding.getBOMEncoding(new Buffer([0xFE, 0xFF])) === \"UTF-16BE\");\nconsole.assert(whatwgEncoding.getBOMEncoding(new Buffer([0x48, 0x69])) === null);\n\nconsole.assert(whatwgEncoding.decode(new Buffer([0x48, 0x69]), \"UTF-8\") === \"Hi\");\n```\n\n## API\n\n- `decode(buffer, fallbackEncodingName)`: performs the [decode](https://encoding.spec.whatwg.org/#decode) algorithm (in which any BOM will override the passed fallback encoding), and returns the resulting string\n- `labelToName(label)`: performs the [get an encoding](https://encoding.spec.whatwg.org/#concept-encoding-get) algorithm and returns the resulting encoding's name, or `null` for failure\n- `isSupported(name)`: returns whether the encoding is one of [the encodings](https://encoding.spec.whatwg.org/#names-and-labels) of the Encoding Standard, _and_ is an encoding that this package can decode (via iconv-lite)\n- `getBOMEncoding(buffer)`: sniffs the first 2–3 bytes of the supplied `Buffer`, returning one of the encoding names `\"UTF-8\"`, `\"UTF-16LE\"`, or `\"UTF-16BE\"` if the appropriate BOM is present, or `null` if no BOM is present\n\n## Unsupported encodings\n\nSince we rely on iconv-lite, we are limited to support only the encodings that they support. Currently we are missing support for:\n\n- ISO-2022-JP\n- ISO-8859-8-I\n- replacement\n- x-mac-cyrillic\n- x-user-defined\n\nPassing these encoding names will return `false` when calling `isSupported`, and passing any of the possible labels for these encodings to `labelToName` will return `null`.\n\n## Credits\n\nThis package was originally based on the excellent work of [@nicolashenry](https://github.com/nicolashenry), [in jsdom](https://github.com/tmpvar/jsdom/blob/7ce11776ce161e8d5921a7a183585327400f786b/lib/jsdom/living/helpers/encoding.js). It has since been pulled out into this separate package.\n\n## Alternatives\n\nIf you are looking for a JavaScript implementation of the Encoding Standard's `TextEncoder` and `TextDecoder` APIs, you'll want [@inexorabletash](https://github.com/inexorabletash)'s [text-encoding](https://github.com/inexorabletash/text-encoding) package.\n",
|
||
"readmeFilename": "README.md",
|
||
"repository": {
|
||
"type": "git",
|
||
"url": "git+https://github.com/jsdom/whatwg-encoding.git"
|
||
},
|
||
"scripts": {
|
||
"lint": "eslint lib test",
|
||
"prepare": "node scripts/update.js",
|
||
"test": "mocha"
|
||
},
|
||
"version": "1.0.3"
|
||
}
|