{"id":21931754,"url":"https://github.com/lekoala/barcode-detector-zbar","last_synced_at":"2025-04-19T19:19:40.193Z","repository":{"id":45893284,"uuid":"431067721","full_name":"lekoala/barcode-detector-zbar","owner":"lekoala","description":"Barcode detector polyfill using zbar.wasm","archived":false,"fork":false,"pushed_at":"2021-12-15T08:55:50.000Z","size":353,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T12:11:24.325Z","etag":null,"topics":["barcode","barcode-scanner","polyfill","wasm","zbar"],"latest_commit_sha":null,"homepage":"","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/lekoala.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},"funding":{"github":"lekoala"}},"created_at":"2021-11-23T11:06:19.000Z","updated_at":"2024-01-25T11:51:50.000Z","dependencies_parsed_at":"2022-09-26T21:40:15.501Z","dependency_job_id":null,"html_url":"https://github.com/lekoala/barcode-detector-zbar","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekoala%2Fbarcode-detector-zbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekoala%2Fbarcode-detector-zbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekoala%2Fbarcode-detector-zbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekoala%2Fbarcode-detector-zbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lekoala","download_url":"https://codeload.github.com/lekoala/barcode-detector-zbar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249777298,"owners_count":21324073,"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":["barcode","barcode-scanner","polyfill","wasm","zbar"],"created_at":"2024-11-28T23:14:55.472Z","updated_at":"2025-04-19T19:19:40.155Z","avatar_url":"https://github.com/lekoala.png","language":"JavaScript","funding_links":["https://github.com/sponsors/lekoala"],"categories":[],"sub_categories":[],"readme":"# Barcode Detector Api Polyfill using zbar.wasm\n\n[![NPM](https://nodei.co/npm/barcode-detector-zbar.png?mini=true)](https://nodei.co/npm/barcode-detector-zbar/)\n[![Downloads](https://img.shields.io/npm/dt/barcode-detector-zbar.svg)](https://www.npmjs.com/package/barcode-detector-zbar)\n\n## How to use\n\nThis is a very simple polyfill using zbar.wasm under the hood written in plain ES6.\n\nYou can install the polyfill with `BarcodeDetectorPolyfill.setupPolyfill()`.\n\n```html\n\u003cscript type=\"module\"\u003e\n  import BarcodeDetectorPolyfill from \"./BarcodeDetectorPolyfill.min.js\";\n\n  console.log(\"Native api support\", BarcodeDetectorPolyfill.checkBarcodeDetectorSupport());\n  BarcodeDetectorPolyfill.setupPolyfill();\n\u003c/script\u003e\n```\n\nSimply use like the regular api (check https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API).\n\n## zbar.wasm\n\nThis polyfill uses zbar.wasm and therefore needs to load a ~200kb bin file in order to work. The polyfill itself is 9.5kb.\n\n## Checking secure context\n\nWebcam is only available in a secure context. Here is some sample code to help you (using Swal to show an error message).\n\n```js\nif (!BarcodeDetectorPolyfill.checkWebcamSupport()) {\n  if (!BarcodeDetectorPolyfill.checkSecureContext()) {\n    Swal.fire(\"You need a secure context!\");\n  } else {\n    Swal.fire(\"No webcam connected!\");\n  }\n}\n```\n\n## You can try the demo\n\nRunning `npm run start` and see demo.html or https://codepen.io/lekoalabe/pen/abyrqaL (currently not working due to CORS issue loading the wasm file)\n\n## Also check out\n\nOther\n- https://zbar-wasm.github.io/demo/\n\nApi ref\n- https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API\n- https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia\n\nScanner app\n- https://github.com/mebjas/html5-qrcode\n- https://github.com/maslick/koder\n\nZbar\n- https://github.com/samsam2310/zbar.wasm\n- https://github.com/mchehab/zbar\n\nZxing\n- https://github.com/zxing-js/browser\n\nOther libs\n- https://www.npmjs.com/package/qr-scanner (worker support)\n- https://serratus.github.io/quaggaJS/ (nice rotation algo)\n- https://github.com/ericblade/quagga2\n\nOther polyfills\n- https://github.com/giladaya/barcode-detector-polyfill\n- https://github.com/gruhn/barcode-detector\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flekoala%2Fbarcode-detector-zbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flekoala%2Fbarcode-detector-zbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flekoala%2Fbarcode-detector-zbar/lists"}