{"id":48289129,"url":"https://github.com/aleris/zxing-typescript","last_synced_at":"2026-04-04T23:00:59.562Z","repository":{"id":57406897,"uuid":"90719277","full_name":"aleris/zxing-typescript","owner":"aleris","description":"Open-source, multi-format 1D/2D barcode image processing library ported from Java in TypeScript usable from node or browser","archived":false,"fork":false,"pushed_at":"2020-10-12T18:50:32.000Z","size":15192,"stargazers_count":77,"open_issues_count":13,"forks_count":30,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-11-20T07:05:06.402Z","etag":null,"topics":["barcode-generator","barcode-reader","barcode-scanner","qr-code","qrcode-generator","zxing","zxing-typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aleris.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}},"created_at":"2017-05-09T08:03:15.000Z","updated_at":"2025-09-29T12:36:08.000Z","dependencies_parsed_at":"2022-09-26T17:01:29.685Z","dependency_job_id":null,"html_url":"https://github.com/aleris/zxing-typescript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aleris/zxing-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleris%2Fzxing-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleris%2Fzxing-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleris%2Fzxing-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleris%2Fzxing-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleris","download_url":"https://codeload.github.com/aleris/zxing-typescript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleris%2Fzxing-typescript/sbom","scorecard":{"id":179377,"data":{"date":"2025-08-11","repo":{"name":"github.com/aleris/zxing-typescript","commit":"ffd55027784de89822bc31e989815ea69258c780"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T18:30:39.196Z","repository_id":57406897,"created_at":"2025-08-16T18:30:39.196Z","updated_at":"2025-08-16T18:30:39.196Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31418286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["barcode-generator","barcode-reader","barcode-scanner","qr-code","qrcode-generator","zxing","zxing-typescript"],"created_at":"2026-04-04T23:00:49.924Z","updated_at":"2026-04-04T23:00:59.524Z","avatar_url":"https://github.com/aleris.png","language":"TypeScript","readme":"ZXing TypeScript\n================\n\n[![Build Status](https://travis-ci.org/aleris/zxing-typescript.svg?branch=master)](https://travis-ci.org/aleris/zxing-typescript)\n\nZXing (\"zebra crossing\") TypeScript is an open-source, multi-format 1D/2D barcode image processing library ported to TypeScript from Java.\n\nSee https://github.com/zxing/zxing for original Java project.\n\nWork In Progress\n================\n\nThis project is work in progress, see [Status and Roadmap](#status-and-roadmap) for what is currently done and what's planned next. \n\nDemo\n====\n\nSee [some demo examples](https://aleris.github.io/zxing-typescript/) in browser.\n\nUsage\n=====\n\nThe library can be used from browser with TypeScript (include anything from src/browser however you must do the packaging yourself) or with plain javascript (see below). It can also be used from node (see also below). The library is using separate builds for node and browser to allow different ES targeting.\n\nBrowser Usage\n-------------\n\nExamples below are for QR barcode, all other supported barcodes work similary.\n\n`npm install zxing-typescript --save`\n\nTo use from javascript you need to build the browser distribution package:\n\n`npm run build.browser.dist`\n\nAnd then include what you need from `build-browser` folder (for example `zxing.qrcodereader.min.js` for qr barcode reader).\n\nOr just grab the minified files that are available in [examples](https://github.com/aleris/zxing-typescript/tree/master/docs/examples).\n\nSee [some demo examples](https://github.com/aleris/zxing-typescript/tree/master/docs/examples) for browser code examples with javascript.\n\nAll the examples are using es6, be sure is supported in your browser or modify as needed (eg. var instead of const etc.). \n\nThe builded library itself is targeting es5 (see `.babelrc`). If you want to target es6 change to `\"presets\": [\"es2016\"]` and add babel-preset-es2016 to dependencies (but be aware that webpack uglify does not yet support es6 as of this writing).\n\nThe browser library is using the [MediaDevices](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices) web api which is marked as experimental as of this writing. You can use external polyfills like [webrtc-adapter](https://github.com/webrtc/adapter) to increase browser compatiblity.\n\nAlso, note that the library is using the [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) (Int32Array, Uint8ClampedArray, etc.) which are not available in older browsers (for example Android 4 default browser, etc.). You can use a polyfill library like [core-js](https://github.com/zloirock/core-js) to support these browsers.\n\n### Scanning from Video Camera\n\nTo display the input from the video camera you will need to add a video element in the html page:\n\n```html\n\u003cvideo id=\"video\" width=\"300\" height=\"200\" style=\"border: 1px solid gray\"\u003e\u003c/video\u003e\n```\n\nTo start decoding, first obtain a list of video input devices with:\n\n```javascript\nconst codeReader = new ZXing.BrowserQRCodeReader()\ncodeReader.getVideoInputDevices()\n    .then((videoInputDevices) =\u003e {\n        videoInputDevices.forEach((element) =\u003e {\n            console.log(`${element.label}, ${element.deviceId}`)            \n        })\n    .catch((err) =\u003e {\n        console.error(err)\n    })\n```\n\nIf there is just one input device you can use the first deviceId and the video element id (in the example below is also 'video') to decode:\n\n```javascript\nconst firstDeviceId = videoInputDevices[0].deviceId\ncodeReader.decodeFromInputVideoDevice(firstDeviceId, 'video')\n    .then((result) =\u003e {\n        console.log(result.text)\n    }).catch((err) =\u003e {\n        console.error(err)\n    })\n```\n\nIf there are more input devices then you will need to chose one for `codeReader.decodeFromInputVideoDevice` device id parameter.\n\nYou can also provide `undefined` for the device id parameter in which case the library will automatically choose the camera, prefering the main (environment facing) camera if more are available:\n\n```javascript\ncodeReader.decodeFromInputVideoDevice(undefined, 'video')\n    .then((result) =\u003e {\n        console.log(result.text)\n    }).catch((err) =\u003e {\n        console.error(err)\n    })\n```\n\nA full working example for [QR Code from Video Camera](https://github.com/aleris/zxing-typescript/tree/master/docs/examples/qr-camera/) is provided in the [examples](https://github.com/aleris/zxing-typescript/tree/master/docs/examples/).\n\n### Scanning from Video File\nSimilar as above you can use a video element in the html page:\n\n```html\n\u003cvideo id=\"video\" width=\"300\" height=\"200\" style=\"border: 1px solid gray\"\u003e\u003c/video\u003e\n```\n\nAnd to decode the video from an url:\n\n```javascript\nconst codeReader = new ZXing.BrowserQRCodeReader()\nconst videoSrc = 'your url to a video'\ncodeReader.decodeFromVideoSource(videoSrc, 'video')\n    .then((result) =\u003e {\n        console.log(result.text)\n    }).catch((err) =\u003e {\n        console.error(err)\n    })\n```\n\nYou can also decode the video url without showing it in the page, in this case no `video` element is needed in html.\n\n```javascript\ncodeReader.decodeFromVideoSource(videoSrc)\n    .then((result) =\u003e {\n        console.log(result.text)\n    }).catch((err) =\u003e {\n        console.error(err)\n    })\n```\n\nA full working example for [QR Code from Video File](https://github.com/aleris/zxing-typescript/tree/master/docs/examples/qr-video/) is provided in the [examples](https://github.com/aleris/zxing-typescript/tree/master/docs/examples/).\n\n\n### Scanning from Image\nSimilar as above you can use a img element in the html page (with src attribute set):\n\n```html\n\u003cimg id=\"img\" src=\"qrcode-image.png\" width=\"200\" height=\"300\" style=\"border: 1px solid gray\"\u003e\u003c/img\u003e\n```\n\nAnd to decode the image:\n\n```javascript\nconst codeReader = new ZXing.BrowserQRCodeReader()\nconst img = document.getElementById('img')\ncodeReader.decodeFromImage(img)\n    .then((result) =\u003e {\n        console.log(result.text)\n    }).catch((err) =\u003e {\n        console.error(err)\n    })\n```\n\nYou can also decode the image url without showing it in the page, in this case no `img` element is needed in html:\n\n```javascript\nconst imgSrc = 'url to image'\ncodeReader.decodeFromImage(undefined, imgSrc)\n    .then((result) =\u003e {\n        console.log(result.text)\n    }).catch((err) =\u003e {\n        console.error(err)\n    })\n```\n\nOr decode the image url directly from an url, with an `img` element in page (notice no `src` attribute is set for `img` element):\n\n```html\n\u003cimg id=\"img\" width=\"200\" height=\"300\" style=\"border: 1px solid gray\"\u003e\u003c/img\u003e\n```\n\n```javascript\nconst imgSrc = 'url to image'\ncodeReader.decodeFromImage('img', imgSrc)//here img is the image id from html, in our case 'img'\n    .then((result) =\u003e {\n        console.log(result.text)\n    }).catch((err) =\u003e {\n        console.error(err)\n    })\n```\n\nA full working example for [QR Code from Image](https://github.com/aleris/zxing-typescript/tree/master/docs/examples/qr-image/) is provided in the [examples](https://github.com/aleris/zxing-typescript/tree/master/docs/examples/).\n\n### Barcode generation\n\nTo generate a QR Code SVG image include 'zxing.qrcodewriter.min.js' from `build-browser`. You will need to include an element where the SVG element will be appended:\n\n```html\n\u003cdiv id=\"result\"\u003e\u003c/div\u003e\n```\n\nAnd then:\n\n```javascript\nconst codeWriter = new ZXing.BrowserQRCodeSvgWriter('result')\nsvgElement = codeWriter.write(input, 300, 300)\n```\n\nA full working example for [QR Code write to SVG](https://github.com/aleris/zxing-typescript/tree/master/docs/examples/qr-svg-writer/) is provided in the [examples](https://github.com/aleris/zxing-typescript/tree/master/docs/examples/).\n\nUsing from TypeScript\n---------------------\n\nInstall the package:\n\n`npm install zxing-typescript --save`\n\nAnd then include directly `.ts` files you need, for example:\n\n```javascript\nimport { BrowserQRCodeReader, VideoInputDevice } from 'zxing-typescript/src/browser/BrowserQRCodeReader'\n```\n\nThe usage is identical with the above.\n\nNode Usage\n----------\n\n`npm install zxing-typescript --save`\n\nIf you want to use plain js (build to es5, see tsconfig.js):\n\n`npm run build.node`\n\nAnd the files will be available in `build-node` folder.\n\nTo use in node you will need to provide an implementation of [`LuminanceSource`](https://github.com/aleris/zxing-typescript/blob/master/src/core/LuminanceSource.ts) for an image. A starting point is [`SharpImageLuminanceSource`](https://github.com/aleris/zxing-typescript/blob/master/src/test/core/SharpImageLuminanceSource.ts) from tests that is using [sharp image processing](https://github.com/lovell/sharp) node library.\n\nNo examples are availabe for now, however you can have a look at the extensive [tests cases](https://github.com/aleris/zxing-typescript/tree/master/src/test/core/qrcode).\n\nText Encoding and Decoding\n==========================\n\nTo decode a barcode, the library needs at some point to decode from bits to text. Also, to generate a barcode it needs to encode text to bits. Unfortunately, the state of encoding and decoding text in javascript/browser is somehow messy at the moment. \n\nTo have full support for all encodings in [CharacterSetECI](https://github.com/aleris/zxing-typescript/blob/master/src/core/common/CharacterSetECI.ts) *except Cp437* use [text-encoding](https://github.com/inexorabletash/text-encoding) library. The library is used implicitly for node (and tests), but is an optional dependency for browser because is rather large (\u003e 600k). You will need to include it yourself if you want/need to use it.\n\nBy default, in browser, [TextDecoder](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder)/[TextEncoder](https://developer.mozilla.org/ro/docs/Web/API/TextEncoder) web api are used if available (take care as these are labeled as experimental as of this writing). Also, be aware that TextEncoder encodes only to UTF-8 as per spec. If these are not available the library falls back to a minimal implementation that only encodes and decodes to/from UTF-8 (see [`StringEncoding`](https://github.com/aleris/zxing-typescript/blob/master/src/core/util/StringEncoding.ts)).\n\nPorting Information\n===================\n\nSee [TypeScript Port Info](typescriptport.md) for information regarding porting approach and reasoning behind some of the approaches taken.\n\nStatus and Roadmap\n==================\n\nSee [Master Plan Project](https://github.com/aleris/zxing-typescript/projects/1).\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleris%2Fzxing-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleris%2Fzxing-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleris%2Fzxing-typescript/lists"}