{"name":"@kayahr/text-encoding","version":"1.0.2","keywords":["typescript","text","encoding","encode","decoding","decode"],"author":{"name":"Klaus Reimer","email":"k@ailis.de"},"license":"MIT","_id":"@kayahr/text-encoding@1.0.2","maintainers":[{"name":"kayahr","email":"k@ailis.de"}],"homepage":"https://github.com/kayahr/text-encoding","bugs":{"url":"https://github.com/kayahr/text-encoding/issues"},"dist":{"shasum":"0e562fc6820138eef153c4b1cf8c5dbb930627a3","tarball":"http://registry-npm.ywwl.com/@kayahr/text-encoding/download/@kayahr/text-encoding-1.0.2.tgz","fileCount":324,"integrity":"sha512-2YRbGbf7ETwhLnu3vZfYsytAJF92YsSnY0GNwFNmOJ+nkWBJBxEDtXyzmwJQPqM4ni9UZDPpsHYeolgWa97nFg==","signatures":[{"sig":"MEUCIGXSPJ8wY0aS/yv9exA2RQ1hO3Av7QnsR2KHj2Ad+p6MAiEAmw9mPVjF+giyYr9L/NhkS5iNqvcPz0sR0Pt5umnjeHc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":775290,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiG6VzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq4gA//TP261qVAkNTuoQSz/X2/qzM9BSvuG5n4G0llM7YrgPxH+BiV\r\nUc1LRi9NJok7TnyXJ0Gyq3a3sESidGc+5J4HPPUA/1H8UJyOaYpczxNuoM1q\r\n1EUZ6asigmH/MrH+1NmiAlxaTE86Od2IGN3DEGah9tnVWV4XVzaqrlTeu8AY\r\nukMoIbgyll+QZTos2xwWCa++9mfVKBf4zNhENJcMdOhKCKjGZa5DqXsTrFt7\r\nnZ1XVI4s0VxXNrjcGgPo/rLjZDm60Z5LB9kFXwumL3Baihrbzjwhvq0I7uKP\r\nqFqDyJdHWg4XyKidJkxnLza2G8nctMFDmUOea1xTZr5Ow7t7wqMGqGvGfDim\r\nHE6rM6CIyVbbo8Gb97POhfUnOsDQLgSK6HRG10T4GlGvFYNqp9tMK8pwvIrc\r\n6UilZPRov8k/0DsCXJGFHHB7WoqssFGp4IW7u1STFwmlkk99kwoE7f+Z0khw\r\n5PBHYYOrD23DBcb054v5S7QScdZJ8r0f22vkSm9SGW1lQUk57lZ2I32pqi8F\r\n5uk+QMXGrnH8Muq8nTvrzwqdnt+N5sddhtx8lIdIDNl/1cNEXFqTEhADBzjg\r\nx6VteP6vU1Mg5Rm2clVMT416AEWp79LwutKgOUq0CfxTJ0PTvIzFwwOJMvLD\r\nhaVlkxVkuwYrRgeNBw3kbJI4UawlzK8gsj0=\r\n=FmdA\r\n-----END PGP SIGNATURE-----\r\n","size":240781,"noattachment":false,"key":"/@kayahr/text-encoding/-/@kayahr/text-encoding-1.0.2.tgz"},"jest":{"projects":[{"testMatch":["<rootDir>/lib/test/**/*.test.js"],"displayName":"node","testEnvironment":"jest-environment-node-single-context"},{"runner":"@kayahr/jest-electron-runner","testMatch":["<rootDir>/lib/test/**/*.test.js"],"displayName":"electron","testEnvironment":"@kayahr/jest-electron-runner/environment"}],"collectCoverageFrom":["<rootDir>/lib/main/**/*.js"]},"types":"lib/main/index.d.ts","$schema":"http://json.schemastore.org/package","exports":{".":"./lib/main/index.js","./encodings/*":"./lib/main/encodings/*.js","./no-encodings":"./lib/main/index-no-encodings.js","./encodings/*.js":"./lib/main/encodings/*.js"},"funding":"https://github.com/kayahr/text-encoding?sponsor=1","gitHead":"1a6033a637ee6f13f57f919169b3ed8efffa37ce","scripts":{"doc":"typedoc --excludePrivate --includes doc --out doc/api --entryPointStrategy expand src/main","lint":"eslint --max-warnings 0 --ext .ts src","test":"npm run cspell && npm run lint && npm run check","check":"jest","clean":"rimraf lib coverage doc/api","watch":"tsc -w","cspell":"cspell --no-progress","compile":"tsc","prepare":"npm run clean && npm run compile","coverage":"jest --coverage"},"_npmUser":{"name":"kayahr","email":"k@ailis.de"},"repository":{"url":"git+https://github.com/kayahr/text-encoding.git","type":"git"},"_npmVersion":"8.5.2","description":"Text encoder and decoder","directories":{},"_nodeVersion":"16.14.0","dependencies":{"tslib":"^2.3.1"},"publishConfig":{"access":"public"},"typesVersions":{"*":{"no-encodings":["lib/main/index-no-encodings.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"jest":"27.5.1","cspell":"5.18.5","eslint":"8.10.0","rimraf":"3.0.2","typedoc":"0.22.12","typescript":"4.5.5","@types/jest":"27.4.1","@types/node":"17.0.21","@kayahr/eslint-config":"2.1.0","@typescript-eslint/parser":"5.12.1","eslint-plugin-deprecation":"1.3.2","@kayahr/jest-electron-runner":"4.4.1","@typescript-eslint/eslint-plugin":"5.12.1","eslint-plugin-simple-import-sort":"7.0.0","jest-environment-node-single-context":"27.2.1"},"_npmOperationalInternal":{"tmp":"tmp/text-encoding_1.0.2_1645978995240_0.7981608835798404","host":"s3://npm-registry-packages"},"readme":"Text Encoding\n=============\n\n[GitHub] | [npm] | [API documentation]\n\nThis project is a heavily refactored fork of the archived [text-encoding](https://github.com/inexorabletash/text-encoding/) library with the following changes:\n\n* Refactored into a modern, modular TypeScript project with separately loadable encodings.\n* Corrected mapping tables and malformed-input recovery across multi-byte encodings.\n* Fixed reusable encoder and decoder state after errors.\n* Added support for modern `BufferSource` inputs, including `SharedArrayBuffer`.\n* Improved lookup and large-input performance.\n* Expanded exhaustive regression and conformance testing.\n\nThe library provides importable `TextEncoder` and `TextDecoder` implementations without modifying the corresponding global objects. Unlike the native `TextEncoder`, it can encode all supported encodings, not only UTF-8.\n\nUsage\n-----\n\nInstall the library as a dependency in your project:\n\n```\nnpm install @kayahr/text-encoding\n```\n\nThen use it as follows:\n\n```typescript\nimport { TextEncoder, TextDecoder } from \"@kayahr/text-encoding\";\n\nconst input = \"中文\";\nconst encoder = new TextEncoder(\"big5\");\nconst encoded = encoder.encode(input);\n\nconst decoder = new TextDecoder(\"big5\");\nconst decoded = decoder.decode(encoded);\n```\n\nImporting `@kayahr/text-encoding` automatically registers all supported encodings. To keep your application as small as possible, use the UTF-8-only entry point instead:\n\n```typescript\nimport { TextEncoder } from \"@kayahr/text-encoding/no-encodings\";\n```\n\nThis entry point registers only UTF-8. To add a specific encoding, import its module:\n\n```typescript\nimport { TextEncoder } from \"@kayahr/text-encoding/no-encodings\";\nimport \"@kayahr/text-encoding/encodings/shift_jis\";\n\nconst encoder = new TextEncoder(\"shift_jis\");\n```\n\nTo register all encodings instead:\n\n```typescript\nimport \"@kayahr/text-encoding/encodings\";\n```\n\nThe `createTextEncoder` helper uses the native `TextEncoder` for UTF-8 when available and this library's implementation for all other encodings:\n\n```typescript\nimport { createTextEncoder } from \"@kayahr/text-encoding\";\n\nconst encoder = createTextEncoder(\"big5\");\n```\n\nSupported encodings\n-------------------\n\nAll listed encodings are supported for both encoding and decoding. Encoding labels are matched case-insensitively and surrounding whitespace is ignored.\n\n| Encoding       | Aliases\n|----------------|-----------------------------------------------------------------------------------------------------\n| big5           | big5-hkscs, cn-big5, csbig5, x-x-big5\n| euc-jp         | cseucpkdfmtjapanese, x-euc-jp\n| euc-kr         | cseuckr, csksc56011987, iso-ir-149, korean, ks_c_5601-1987, ks_c_5601-1989, ksc5601, ksc_5601, windows-949\n| gb18030        |\n| gbk            | chinese, csgb2312, csiso58gb231280, gb2312, gb_2312, gb_2312-80, iso-ir-58, x-gbk\n| ibm866         | 866, cp866, csibm866\n| iso-2022-jp    | csiso2022jp\n| shift_jis      | csshiftjis, ms932, ms_kanji, shift-jis, sjis, windows-31j, x-sjis\n| utf-8          | unicode-1-1-utf-8, unicode11utf8, unicode20utf8, utf8, x-unicode20utf8\n| utf-16le       | csunicode, iso-10646-ucs-2, ucs-2, unicode, unicodefeff, utf-16\n| utf-16be       | unicodefffe\n| iso-8859-2     | csisolatin2, iso-ir-101, iso8859-2, iso88592, iso_8859-2, iso_8859-2:1987, l2, latin2\n| iso-8859-3     | csisolatin3, iso-ir-109, iso8859-3, iso88593, iso_8859-3, iso_8859-3:1988, l3, latin3\n| iso-8859-4     | csisolatin4, iso-ir-110, iso8859-4, iso88594, iso_8859-4, iso_8859-4:1988, l4, latin4\n| iso-8859-5     | csisolatincyrillic, cyrillic, iso-ir-144, iso8859-5, iso88595, iso_8859-5, iso_8859-5:1988\n| iso-8859-6     | arabic, asmo-708, csiso88596e, csiso88596i, csisolatinarabic, ecma-114, iso-8859-6-e, iso-8859-6-i, iso-ir-127, iso8859-6, iso88596, iso_8859-6, iso_8859-6:1987\n| iso-8859-7     | csisolatingreek, ecma-118, elot_928, greek, greek8, iso-ir-126, iso8859-7, iso88597, iso_8859-7, iso_8859-7:1987, sun_eu_greek\n| iso-8859-8     | csiso88598e, csisolatinhebrew, hebrew, iso-8859-8-e, iso-ir-138, iso8859-8, iso88598, iso_8859-8, iso_8859-8:1988, visual\n| iso-8859-8-i   | csiso88598i, logical\n| iso-8859-10    | csisolatin6, iso-ir-157, iso8859-10, iso885910, l6, latin6\n| iso-8859-13    | iso8859-13, iso885913\n| iso-8859-14    | iso8859-14, iso885914\n| iso-8859-15    | csisolatin9, iso8859-15, iso885915, iso_8859-15, l9\n| iso-8859-16    |\n| koi8-r         | cskoi8r, koi, koi8, koi8_r\n| koi8-u         | koi8-ru\n| macintosh      | csmacintosh, mac, x-mac-roman\n| windows-874    | dos-874, iso-8859-11, iso8859-11, iso885911, tis-620\n| windows-1250   | cp1250, x-cp1250\n| windows-1251   | cp1251, x-cp1251\n| windows-1252   | ansi_x3.4-1968, ascii, cp1252, cp819, csisolatin1, ibm819, iso-8859-1, iso-ir-100, iso8859-1, iso88591, iso_8859-1, iso_8859-1:1987, l1, latin1, us-ascii, x-cp1252\n| windows-1253   | cp1253, x-cp1253\n| windows-1254   | cp1254, csisolatin5, iso-8859-9, iso-ir-148, iso8859-9, iso88599, iso_8859-9, iso_8859-9:1989, l5, latin5, x-cp1254\n| windows-1255   | cp1255, x-cp1255\n| windows-1256   | cp1256, x-cp1256\n| windows-1257   | cp1257, x-cp1257\n| windows-1258   | cp1258, x-cp1258\n| x-mac-cyrillic | x-mac-ukrainian\n| x-user-defined |\n\n[API documentation]: https://kayahr.github.io/text-encoding/\n[GitHub]: https://github.com/kayahr/text-encoding\n[npm]: https://www.npmjs.com/package/@kayahr/text-encoding\n","publish_time":1645978995418,"_cnpm_publish_time":1645978995418,"dist-tags":{"latest":"2.2.0"}}