{"id":21412822,"url":"https://github.com/hunghg255/hqr","last_synced_at":"2025-07-14T02:32:29.713Z","repository":{"id":206630608,"uuid":"679578707","full_name":"hunghg255/hqr","owner":"hunghg255","description":"Generate QR code","archived":false,"fork":false,"pushed_at":"2024-08-13T08:28:18.000Z","size":521,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-14T11:37:05.517Z","etag":null,"topics":["base64","cli","npm","qr","qrcode","qrcode-generator","uri"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/hunghg255.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2023-08-17T06:46:06.000Z","updated_at":"2024-10-07T02:24:17.000Z","dependencies_parsed_at":"2023-11-11T08:21:31.777Z","dependency_job_id":"3bab61bf-9b37-4470-ae38-bead61cb8a6d","html_url":"https://github.com/hunghg255/hqr","commit_stats":null,"previous_names":["hunghg255/hqr"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunghg255%2Fhqr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunghg255%2Fhqr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunghg255%2Fhqr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunghg255%2Fhqr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hunghg255","download_url":"https://codeload.github.com/hunghg255/hqr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225942791,"owners_count":17549088,"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":["base64","cli","npm","qr","qrcode","qrcode-generator","uri"],"created_at":"2024-11-22T18:15:51.803Z","updated_at":"2024-11-22T18:15:52.488Z","avatar_url":"https://github.com/hunghg255.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.npmjs.com/package/hqr\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n\u003cimg src=\"https://api.iconify.design/streamline:qr-code.svg?color=%23fdb4e2\" alt=\"logo\" width='100'/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  A library generate QR code from text\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/hqr\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://badge.fury.io/js/csvs-parsers.svg\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/hqr\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/csvs-parsers.svg?logo=npm\" alt=\"NPM Downloads\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://bundlephobia.com/result?p=hqr\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://img.shields.io/bundlephobia/minzip/hqr\" alt=\"Minizip\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/hunghg255/hqr/graphs/contributors\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://img.shields.io/badge/all_contributors-1-orange.svg\" alt=\"Contributors\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/hunghg255/hqr/blob/main/LICENSE\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://badgen.net/github/license/hunghg255/hqr\" alt=\"License\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nGenerate QR Code universally, in any runtime, to ANSI, Unicode or SVG. ES module , zero dependency, tree-shakable.\n\n## Install\n\n```bash\n# Using npm\nnpm install hqr\n\n# Using yarn\nyarn add hqr\n\n# Using pnpm\npnpm add hqr\n```\n\n## Usage CLI\n```bash\nnpx hqr --text \"Hello, World!\"\n```\n\n## Usage\n\n```ts\nimport {\n  encode,\n  renderANSI,\n  renderSVG,\n  renderUnicode,\n  renderUnicodeCompact,\n  renderBase64\n} from 'hqr'\n\nconst svg = renderSVG('Hello, World!')\n\nconst ansi = renderANSI('https://192.168.1.100:3000', {\n  // Error correction level\n  ecc: 'L',\n  // Border width\n  border: 2,\n})\n\n// display QR Code in terminal\nconsole.log(ansi)\n```\n\n## API\n\n### `encode`\n\nEncode plain text or binary data into QR Code represented by a 2D array.\n\n```ts\nimport { encode } from 'hqr'\n\nconst {\n  data, // 2D array of boolean, representing the QR Code\n  version, // QR Code version\n  size, // size of the QR Code\n} = encode(text, options)\n```\n\n### `renderANSI`\n\nRender QR Code to [ANSI colored](https://ss64.com/nt/syntax-ansi.html) string.\n\n```ts\nimport { renderANSI } from 'hqr'\n\nconst string = renderANSI(text, options)\n\nconsole.log(string)\n```\n\n### `renderUnicode`\n\nRender QR Code to Unicode string for each pixel. By default it uses `█` and `░` to represent black and white pixels, and it can be customizable.\n\n```ts\nimport { renderUnicode } from 'hqr'\n\nconst string = renderUnicode(text, {\n  blackChar: '█',\n  whiteChar: '░',\n  // ...other options\n})\n```\n\n### `renderUnicodeCompact`\n\nRender QR Code with two rows into one line with unicode `▀`, `▄`, `█`, ` `. It is useful when you want to display QR Code in terminal with limited height.\n\n```ts\nimport { renderUnicodeCompact } from 'hqr'\n\nconst string = renderUnicodeCompact(text, options)\n\nconsole.log(string)\n```\n\n### `renderSVG`\n\nRender QR Code to SVG string.\n\n```ts\nimport { renderSVG } from 'hqr'\n\nconst string = renderSVG(text, options)\n```\n\n### `renderBase64`\n\nRender QR Code to SVG string.\n\n```ts\nimport { renderBase64 } from 'hqr'\n\nconst string = renderBase64(text, options)\n```\n\n## Credits\n\nQR Code generation algorithm is modified from [nayuki/QR-Code-generator](https://github.com/nayuki/QR-Code-generator/blob/master/typescript-javascript/qrcodegen.ts) by Project Nayuki.\n\nCLI renders are inspired by [qrcode-terminal](https://github.com/gtanner/qrcode-terminal).\n\n## License\n\n[MIT](./LICENSE) License\n\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/hqr?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[npm-version-href]: https://npmjs.com/package/hqr\n[npm-downloads-src]: https://img.shields.io/npm/dm/hqr?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[npm-downloads-href]: https://npmjs.com/package/hqr\n[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/hqr/main?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[codecov-href]: https://codecov.io/gh/unjs/hqr\n[bundle-src]: https://img.shields.io/bundlephobia/minzip/hqr?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[bundle-href]: https://bundlephobia.com/result?p=hqr\n[license-src]: https://img.shields.io/github/license/unjs/hqr.svg?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[license-href]: https://github.com/unjs/hqr/blob/main/LICENSE\n[jsdocs-src]: https://img.shields.io/badge/jsDocs.io-reference-18181B?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[jsdocs-href]: https://www.jsdocs.io/package/hqr\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunghg255%2Fhqr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunghg255%2Fhqr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunghg255%2Fhqr/lists"}