{"name":"@kayahr/text-encoding","version":"1.3.0","keywords":["typescript","text","encoding","encode","decoding","decode"],"author":{"name":"Klaus Reimer","email":"k@ailis.de"},"license":"MIT","_id":"@kayahr/text-encoding@1.3.0","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":"90ae1007dc86d35a977cd709dfa9fe21cc2bc8c6","tarball":"http://registry-npm.ywwl.com/@kayahr/text-encoding/download/@kayahr/text-encoding-1.3.0.tgz","fileCount":324,"integrity":"sha512-JjQVFXnN/ynXN+GDgpwNM+PJ4NwDFZwRolgSu4bYG1JKuRreVFY5uss5K/lsH6qY38+WgU7M40M2SHoiWQHKgQ==","signatures":[{"sig":"MEUCIGPEEvKsvgAQcMcRYuguOsJelG4QxPqXF3ABmyEC9TgaAiEA0ew59Q9by0gFiWCKUyMA7OTT30lsRmJeWq72Pc9tAzs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":765227,"size":238383,"noattachment":false,"key":"/@kayahr/text-encoding/-/@kayahr/text-encoding-1.3.0.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","./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":"7aa7e09621a2de979be74855c685e525eea9a7f5","scripts":{"doc":"typedoc","lint":"eslint --max-warnings 0 --ext .ts src","test":"npm run check && npm run lint && npm run doc -- --emit none && npm run cspell","check":"jest","clean":"rimraf lib coverage doc/api","cspell":"cspell --no-progress","compile":"tsc","prepare":"npm run clean && npm run compile"},"_npmUser":{"name":"kayahr","email":"k@ailis.de"},"repository":{"url":"git+https://github.com/kayahr/text-encoding.git","type":"git"},"_npmVersion":"10.4.0","description":"Text encoder and decoder","directories":{},"_nodeVersion":"20.11.0","dependencies":{"tslib":"^2.6.2"},"publishConfig":{"access":"public"},"typesVersions":{"*":{"no-encodings":["lib/main/index-no-encodings.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"jest":"29.7.0","cspell":"8.3.2","eslint":"8.56.0","rimraf":"5.0.5","typedoc":"0.25.7","typescript":"5.3.3","@types/jest":"29.5.12","@types/node":"20.11.16","@kayahr/eslint-config":"2.10.2","@typescript-eslint/parser":"6.20.0","eslint-plugin-deprecation":"2.0.0","@kayahr/jest-electron-runner":"29.11.0","@typescript-eslint/eslint-plugin":"6.20.0","eslint-plugin-simple-import-sort":"10.0.0","jest-environment-node-single-context":"29.4.0"},"_npmOperationalInternal":{"tmp":"tmp/text-encoding_1.3.0_1707082128399_0.3626765664301763","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":1707082128636,"_cnpm_publish_time":1707082128636,"dist-tags":{"latest":"2.2.0"}}