{"id":18321798,"url":"https://github.com/chillerlan/js-qrcode","last_synced_at":"2025-04-05T22:32:31.284Z","repository":{"id":48037034,"uuid":"516484785","full_name":"chillerlan/js-qrcode","owner":"chillerlan","description":"A javascript port of chillerlan/php-qrcode","archived":false,"fork":false,"pushed_at":"2024-08-25T13:12:52.000Z","size":1073,"stargazers_count":39,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-21T13:21:48.018Z","etag":null,"topics":["es6","javascript-library","javascript-qrcode","js-qrcode","qrcode","qrcode-generator"],"latest_commit_sha":null,"homepage":"https://github.com/chillerlan/php-qrcode","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chillerlan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"codemasher","custom":"https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4"}},"created_at":"2022-07-21T18:40:41.000Z","updated_at":"2025-03-02T03:34:39.000Z","dependencies_parsed_at":"2023-12-20T11:46:55.945Z","dependency_job_id":"d9f6896d-5fb4-489b-b629-e80e098a4f1c","html_url":"https://github.com/chillerlan/js-qrcode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fjs-qrcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fjs-qrcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fjs-qrcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fjs-qrcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chillerlan","download_url":"https://codeload.github.com/chillerlan/js-qrcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411234,"owners_count":20934650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["es6","javascript-library","javascript-qrcode","js-qrcode","qrcode","qrcode-generator"],"created_at":"2024-11-05T18:21:38.177Z","updated_at":"2025-04-05T22:32:30.735Z","avatar_url":"https://github.com/chillerlan.png","language":"JavaScript","readme":"# chillerlan/js-qrcode\n\nA javascript port of [chillerlan/php-qrcode](https://github.com/chillerlan/php-qrcode), a QR Code library based on the [implementation](https://github.com/kazuhikoarase/qrcode-generator) by Kazuhiko Arase.\n\n[![NPM version][npm-badge]][npm]\n[![License][license-badge]][license]\n[![CodeCov][coverage-badge]][coverage]\n[![Build][gh-action-badge]][gh-action]\n[![NPM downloads][npm-downloads]][npm]\n\n[npm-badge]: https://img.shields.io/npm/v/%40chillerlan%2Fqrcode?logo=npm\u0026logoColor=ccc\n[npm-downloads]: https://img.shields.io/npm/dm/%40chillerlan%2Fqrcode?logo=npm\u0026logoColor=ccc\n[npm]: https://www.npmjs.com/package/@chillerlan/qrcode\n[license-badge]: https://img.shields.io/github/license/chillerlan/js-qrcode.svg\n[license]: https://github.com/chillerlan/js-qrcode/blob/main/LICENSE\n[coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/js-qrcode?logo=codecov\u0026logoColor=ccc\n[coverage]: https://codecov.io/github/chillerlan/js-qrcode\n[gh-action-badge]: https://img.shields.io/github/actions/workflow/status/chillerlan/js-qrcode/build.yml?branch=main\u0026logo=github\u0026logoColor=ccc\n[gh-action]: https://github.com/chillerlan/js-qrcode/actions/workflows/build.yml?query=branch%3Amain\n\n\n# Overview\n\n## Features\n\n- Creation of [Model 2 QR Codes](https://www.qrcode.com/en/codes/model12.html), [Version 1 to 40](https://www.qrcode.com/en/about/version.html)\n- [ECC Levels](https://www.qrcode.com/en/about/error_correction.html) L/M/Q/H supported\n- Mixed mode support (encoding modes can be combined within a QR symbol). Supported modes:\n\t- numeric\n\t- alphanumeric\n\t- 8-bit binary\n- Flexible, easily extensible output modules, built-in support for the following output formats:\n\t- Markup types: SVG, etc.\n\t- String types: JSON, plain text, etc.\n    - Raster image types via [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement)\n\n\n## Documentation\n\nThe API is very similar to [the PHP version of this library](https://github.com/chillerlan/php-qrcode), and you can refer to its [documentation](https://php-qrcode.readthedocs.io/) and [examples](https://github.com/chillerlan/php-qrcode/tree/main/examples) for most parts.\n\nKey differences:\n\n- Class constants of the PHP version are regular constants here, e.g. `QRMatrix::M_DATA` becomes `M_DATA`, `Version::AUTO` is `VERSION_AUTO` and `EccLevel:L` to `ECC_L` - see [index.js](https://github.com/chillerlan/js-qrcode/blob/main/src/index.js) for the proper names of all symbols.\n- No multimode support for Kanji and Hanzi character sets (handling/converting non-UTF8 strings in javascript is a mess), no [ECI](https://en.wikipedia.org/wiki/Extended_Channel_Interpretation) support for the same reason.\n- save-to-file is not supported. You can re-implement the method `QROutputAbstract::saveToFile()` in case you need it. It's called internally, but it has no function.\n- No QR Code reader included\n- The usual javascript quirks:\n\t- the internal structure of some classes may deviate from their PHP counterparts\n\t- key-value arrays become objects, causing inconsistent return values in some cases, not to mention the inconsistent loop types for each (pun intended)\n\t- numbers may act strange\n\t- magic getters and setters come with downsides, [see this comment](https://github.com/chillerlan/js-qrcode/blob/76a7a8db1b6e39d09a09f2091a830dcd7d98e9ff/src/QROptions.js#L352-L412)\n\nAn API documentation created with [jsdoc](https://github.com/jsdoc/jsdoc) can be found at https://chillerlan.github.io/js-qrcode/ (WIP).\n\n### Installation\n\nVia terminal: `npm i @chillerlan/qrcode`\n\nIn `package.json`: \n\n```json\n{\n\t\"dependencies\": {\n\t\t\"@chillerlan/qrcode\": \"^1.0\"\n\t}\n}\n```\n\n### Quickstart\n\nServer-side, in nodejs:\n```js\nimport {QRCode} from './dist/js-qrcode-node-src.cjs';\n\nlet data   = 'otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5\u0026issuer=chillerlan.net';\nlet qrcode = (new QRCode()).render(data);\n\n// do stuff\nconsole.log(qrcode);\n```\n\nClient-side, in a webbrowser:\n```html\n\u003cdiv id=\"qrcode-container\"\u003e\u003c/div\u003e\n\u003cscript type=\"module\"\u003e\n\timport {QRCode} from './dist/js-qrcode-es6-src.js';\n\t\n\t// an SVG image as base64 data URI will be returned by default\n\tlet qrcode = (new QRCode()).render('https://www.youtube.com/watch?v=dQw4w9WgXcQ');\n\n\t// append it to the DOM\n\tlet img = document.createElement('img');\n\timg.alt = 'QRCode';\n\timg.src = qrcode\n\t\n\tdocument.getElementById('qrcode-container').appendChild(img);\n\u003c/script\u003e\n```\n\u003cp align=\"center\"\u003e\n\t\u003cimg alt=\"QR codes are awesome!\" style=\"width: auto; height: 530px;\" src=\"https://raw.githubusercontent.com/chillerlan/php-qrcode/main/.github/images/example.svg\"\u003e\n\u003c/p\u003e\n\nHave a look [in the examples folder](https://github.com/chillerlan/js-qrcode/tree/main/examples) for some more usage examples.\n\n\n#### License notice\nParts of this code are ported to js (via php) from the [ZXing project](https://github.com/zxing/zxing) and licensed under the [Apache License, Version 2.0](./NOTICE).\n\n\n#### Trademark Notice\n\nThe word \"QR Code\" is a registered trademark of *DENSO WAVE INCORPORATED*\u003cbr\u003e\nhttps://www.qrcode.com/en/faq.html#patentH2Title\n","funding_links":["https://ko-fi.com/codemasher","https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchillerlan%2Fjs-qrcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchillerlan%2Fjs-qrcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchillerlan%2Fjs-qrcode/lists"}