{"id":16724888,"url":"https://github.com/kaworu/node-quirc","last_synced_at":"2025-09-07T14:11:48.736Z","repository":{"id":11540537,"uuid":"63597751","full_name":"kaworu/node-quirc","owner":"kaworu","description":"A NodeJS port of the quirc library (QR decoder library - https://github.com/dlbeer/quirc)","archived":false,"fork":false,"pushed_at":"2025-02-24T10:58:13.000Z","size":2234,"stargazers_count":14,"open_issues_count":6,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-26T12:18:28.496Z","etag":null,"topics":["nodejs-modules","qrcode-scanner"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaworu.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":"2016-07-18T11:34:13.000Z","updated_at":"2025-01-13T08:38:22.000Z","dependencies_parsed_at":"2022-09-15T22:31:41.041Z","dependency_job_id":"3fedc315-fc6d-4c1d-9008-056626bb05c8","html_url":"https://github.com/kaworu/node-quirc","commit_stats":{"total_commits":109,"total_committers":5,"mean_commits":21.8,"dds":"0.33944954128440363","last_synced_commit":"11e68b8f364ef178e6acc82f5320614034eb37f5"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaworu%2Fnode-quirc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaworu%2Fnode-quirc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaworu%2Fnode-quirc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaworu%2Fnode-quirc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaworu","download_url":"https://codeload.github.com/kaworu/node-quirc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243836015,"owners_count":20355615,"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":["nodejs-modules","qrcode-scanner"],"created_at":"2024-10-12T22:47:09.338Z","updated_at":"2025-03-17T01:31:31.683Z","avatar_url":"https://github.com/kaworu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM Version](https://img.shields.io/npm/v/node-quirc.svg)](https://npmjs.org/package/node-quirc)\n![Test](https://github.com/kAworu/node-quirc/workflows/Test/badge.svg)\n\n# node-quirc\nA Node.js Addon of the quirc library (QR decoder library - https://github.com/dlbeer/quirc).\n\n# installation\nFirst, You need libpng and libjpeg (and their header files) installed. Then, simply\n```\n% npm install node-quirc\n```\n\n# documentation\nnode-quirc aim to be simple to use, the module exposes a `decode()` function\nand a `constants` object.\n\n\n## decode(img[, callback])\n`img` must be either a `Buffer` of a PNG or JPEG encoded image file, or a\ndecoded image in [`ImageData`](https://developer.mozilla.org/en-US/docs/Web/API/ImageData)\nformat with 1 (grayscale), 3 (RGB) or 4 (RGBA) channels.\n\nWhen `callback` is provided, it is expected to be a \"classic\" Node.js callback\nfunction, taking an error as first argument and the result as second argument.\nBecause the provided image file may contains several QR Code, the result is\nalways an array on success.\n\nWhen `decode` is called only with `img` as argument, a `Promise` is returned.\n\n```javascript\nconst fs    = require(\"fs\");\nconst quirc = require(\"node-quirc\");\n\n// load the image file\nconst img = fs.readFileSync(\"./test/data/Hello+World.png\");\n\n// callback version\nquirc.decode(img, (err, codes) =\u003e {\n    if (err) {\n        // handle err.\n        console.error(`decode failed: ${err.message}`);\n    } else {\n        // do something with codes.\n        console.dir(codes);\n        console.log(codes.map((code) =\u003e code.data.toString('utf8')));\n    }\n});\n\n// Promise version\nquirc.decode(img).then((codes) =\u003e {\n    // do something with codes.\n}).catch((err) =\u003e {\n    // handle err.\n});\n\n// alternatively, use an already-loaded ImageData, e.g. from the `canvas` library\nconst context = canvas.getContext('2d');\nconst imageData = context.getImageData(0, 0, 800, 600);\nquirc.decode(imageData).then((codes) =\u003e {\n    // do something with codes.\n    console.log(`codes read from ImageData (size=${\n        imageData.data.length\n    }, width=${imageData.width}, height=${\n        imageData.height\n    }):`, codes);\n}).catch((err) =\u003e {\n    // handle err.\n});\n```\n\noutput:\n\n```\n[\n  {\n    version: 1,\n    ecc_level: 'H',\n    mask: 1,\n    mode: 'BYTE',\n    eci: 'UTF_8',\n    data: Buffer [Uint8Array] [ 72, 101, 108, 108, 111 ]\n  },\n  {\n    version: 1,\n    ecc_level: 'H',\n    mask: 3,\n    mode: 'BYTE',\n    eci: 'UTF_8',\n    data: Buffer [Uint8Array] [ 87, 111, 114, 108, 100 ]\n  }\n]\n[ 'Hello', 'World' ]\n```\n\n## constants\nsee https://github.com/kAworu/node-quirc/blob/master/index.js#L68-L99\n\n\n# testing\nClone the repo and then simply\n```\n% npm install \u0026\u0026 npm test\n```\n\n# license\nMIT, see [LICENSE](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaworu%2Fnode-quirc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaworu%2Fnode-quirc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaworu%2Fnode-quirc/lists"}