{"name":"utf-8","version":"2.0.0","keywords":["utf-8","encode","decode","encoder","decoder","strict"],"author":{"name":"Nicolas Froidure"},"license":"MIT","_id":"utf-8@2.0.0","maintainers":[{"name":"cipherboy","email":"alexander.m.scheel@gmail.com"},{"name":"nfroidure","email":"nfroidure@elitwork.com"}],"homepage":"https://github.com/nfroidure/UTF8.js#readme","bugs":{"url":"https://github.com/nfroidure/UTF8.js/issues"},"dist":{"shasum":"6c2a309d683958862a01b5bf8e1d2dff46d36bf9","tarball":"http://registry-npm.ywwl.com/utf-8/download/utf-8-2.0.0.tgz","fileCount":21,"integrity":"sha512-DItg/Z20ltBzugPrb8Mx1oN0F8CqN5bD38T57YM/pF/GOzUsNVXiellI0PbJPq3e1Z7BEDNoWP1H1+4n7g54Cg==","signatures":[{"sig":"MEUCIQCUfsVXyAhrMioYNX8nip6+K7Oh5pO4wN57bijGMQJL3QIgAKwdiImIjzeQXJpMh2gU9op8FLtYcAHcI++qqMwZRlI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":40706,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa5YFqCRA9TVsSAnZWagAAW5kP/RbmgdohbDb8O9CcgMLU\n00d/UXYzXVYOt/+SA6/40wL/onqeYzCG/JXG+T4VdvIL7MAKhKQZ1wT+R/IM\nwH15u+bQxGhngBRVCuxGa0S7UmyZCko2/vWzumrOO4a1XGli2JCXpvucmTzC\nYMXsVrfwZiFcYiRWA2jN+mhv9uGX+rcq01IS5V+zQUI/Z+bRmnnQfh2b+le+\nr4M1SX4VAoUl46Ivje0nPj6J9Yaqc5PuyhqluUg7Uv6D0Inhf0S66DRw0bA3\no9nIE/QhOcyCfBRXLZn+Nq8JBSYVNhSfhOqErYIXyhNnEo4vGRcb+gYerVUp\noKX3E3+jMe1KqDm32Nmo4oaAEOoiK+u+pnOrPc+Mcr7eI/5r4fTVY7fk8Enx\nhpdnul4cL7aoSfxa25RsR3smLgv0WETD3ArZiHKdujo33KEki7Hp7tUSf2CK\nC+xjbJRzYASNyRSyWfvui6qrCWWIkmvfcty3Z5Fq3yeWKNGw2yEtKhXTbfyJ\nN/cttl0hXP7Dj0p/xjlk4vTNKzKmfegJgxt20OEXBgd7kq9QuOpcjkcyf9YI\nYcm6K9mdjZi5v29mi8WIIKgSBjNmNpoePYDCtgE2hC7pYWPgXPqh6n0RdNEN\nl+8d6kGhZm+BHJJoFDEmpl+1fMLo0TOWAwEQNvXG1l1HNMvMTqvuqiQkOZh3\nxZTl\r\n=fGye\r\n-----END PGP SIGNATURE-----\r\n","size":13426,"noattachment":false,"key":"/utf-8/-/utf-8-2.0.0.tgz"},"main":"./src/UTF8.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"engines":{"node":">=6.9.5"},"gitHead":"7a86f2e2706c06a991d6bb3c57402e2e00ff62e5","metapak":{"data":{"files":"src/*.js tests/*.mocha.js","testsFiles":"tests/*.mocha.js"},"configs":["readme","mocha","eslint","codeclimate","travis","karma"]},"scripts":{"cz":"env NODE_ENV=${NODE_ENV:-cli} git cz","cli":"env NODE_ENV=${NODE_ENV:-cli}","lint":"eslint src/*.js tests/*.mocha.js","test":"npm run mocha && npm run karma","cover":"istanbul cover _mocha --report html -- tests/*.mocha.js -R spec -t 5000","karma":"karma start karma.conf.js","mocha":"mocha tests/*.mocha.js","metapak":"metapak","version":"npm run changelog && git add CHANGELOG.md","prettier":"prettier --write src/*.js tests/*.mocha.js","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","coveralls":"istanbul cover _mocha --report lcovonly -- tests/*.mocha.js -R spec -t 5000 && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage","preversion":"npm t && npm run lint && npm run metapak -s"},"_npmUser":{"name":"nfroidure","email":"nicolas.froidure@insertafter.com"},"repository":{"url":"git+ssh://git@github.com/nfroidure/UTF8.js.git","type":"git"},"_npmVersion":"5.8.0","description":"Encode/decode UTF8.","directories":{},"greenkeeper":{"ignore":["commitizen","cz-conventional-changelog","conventional-changelog-cli","mocha","mocha-lcov-reporter","coveralls","istanbul","eslint","eslint-config-prettier","prettier"]},"_nodeVersion":"8.10.0","preferGlobal":"false","_hasShrinkwrap":false,"devDependencies":{"karma":"^2.0.0","mocha":"^5.0.0","eslint":"^4.19.0","metapak":"1.0.3","istanbul":"^0.4.5","prettier":"^1.11.1","coveralls":"^3.0.0","browserify":"^14.4.0","commitizen":"^2.9.6","karma-mocha":"^1.3.0","jasmine-core":"^2.7.0","karma-jasmine":"^1.1.0","karma-browserify":"^5.1.1","metapak-nfroidure":"6.0.0","mocha-lcov-reporter":"^1.3.0","karma-chrome-launcher":"^2.2.0","eslint-plugin-prettier":"^2.6.0","karma-firefox-launcher":"^1.1.0","cz-conventional-changelog":"^2.1.0","conventional-changelog-cli":"^1.3.8"},"_npmOperationalInternal":{"tmp":"tmp/utf-8_2.0.0_1524990313496_0.627468307913366","host":"s3://npm-registry-packages"},"readme":"[//]: # ( )\n[//]: # (This file is automatically generated by a `metapak`)\n[//]: # (module. Do not change it  except between the)\n[//]: # (`content:start/end` flags, your changes would)\n[//]: # (be overridden.)\n[//]: # ( )\n# utf-8\n> Encode/decode UTF8.\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/utf-8/blob/main/LICENSE)\n\n\n[//]: # (::contents:start)\n\nAs you probably noticed, there is already standards ways to\n encode/decode utf-8 strings into buffers in the NodeJS\n standard library.\n\nThis library can be useful if you need to write at given buffer\n indexes or to validate utf-8 encoded buffers.\n\nOtherwise, use NodeJS standard library.\n\n## Usage\n\n```sh\nnpm install utf-8\n```\n\n### Encoding\n\nA char:\n\n```js\nimport * as UTF8 from 'utf-8';\n\nUTF8.setBytesFromCharCode('é'.charCodeAt(0));\n// [0xC3, 0xA9]\n```\n\nA string:\n\n```js\nUTF8.setBytesFromString('1.3$ ~= 1€');\n// [49, 46, 51, 36, 32, 126, 61, 32, 49, 226, 130, 172]\n```\n\n### Decoding\n\nA char:\n\n```js\nString.fromCharCode(UTF8.getCharCode([0xc3, 0xa9]));\n// 'é'\n```\n\nA string:\n\n```js\nUTF8.getStringFromBytes([49, 46, 51, 36, 32, 126, 61, 32, 49, 226, 130, 172]);\n// '1.3$ ~= 1€'\n```\n\n### TypedArrays are welcome\n\nAs inputs:\n\n```js\nconst bytes = new Uint8Array([\n  0xc3, 0xa9, 49, 46, 51, 36, 32, 126, 61, 32, 49, 226, 130, 172,\n]);\n\n// The first char\nString.fromCharCode(UTF8.getCharCode(bytes));\n// é\n\n// The following string at the offset 2\nUTF8.getStringFromBytes(bytes, 2);\n// '1.3$ ~= 1€'\n```\n\nAs well as outputs :\n\n```js\nconst bytes = new Uint8Array(14);\n\n// First encoding a char\nUTF8.setBytesFromCharCode('é'.charCodeAt(0));\n\n// Then encoding a string\nUTF8.setBytesFromString('1.3$ ~= 1€', 2);\n```\n\n## UTF8 encoding detection\n\n```js\nUTF8.isNotUTF8(bytes);\n// true | false\n```\n\nThis function can prove the text contained by the given bytes is not UTF-8 (or\nbadly encoded UTF-8 string). It's not reciprocally true, especially for short\nstrings with which false positives are frequent.\n\n## Strict mode\n\nIf you try to encode an UTF8 string in an ArrayBuffer too short to contain the\ncomplete string, it will silently fail. To avoid this behavior, use the strict\nmode :\n\n```js\nUTF8.setBytesFromString('1.3$ ~= 1€', 2, null, true);\n```\n\n# Thanks\n\n- The Debian project for it's free (as freedom) russian/japanese man pages used\n  for real world files tests!\n\n[//]: # (::contents:end)\n\n# Authors\n- [Nicolas Froidure](https://insertafter.com/en/index.html)\n\n# License\n[MIT](https://github.com/nfroidure/utf-8/blob/main/LICENSE)\n","publish_time":1524990313591,"_cnpm_publish_time":1524990313591,"dist-tags":{"latest":"3.0.0"}}