
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@impactdk/barcode-scanner
Advanced tools
A barcode scanner module, using a webassembly module built on [ZBar](https://github.com/ZBar/ZBar), which supports a variety of different barcodes.
A barcode scanner module, using a webassembly module built on ZBar, which supports a variety of different barcodes.
npm install --save @impactdk/barcode-scanner
As the default decoder for the scanner is dependant on a wasm module running in a worker, some assets need to be installed from the module and into the public assets of your own. It is advised to do this as part of your build:
install-wasm-decoder ./path/to/your/assets
This path is then later needed in the configuration of the decoder.
import { WasmDecoder, Scanner, IBarcode } from "@impactdk/barcode-scanner";
const videoElement: HTMLVideoElement = document.getElementById("scanner-video");
const decoder = new WasmDecoder("/public/path"); // A directory where the installed wasm decoder assets are made publicly available.
const scanner = new Scanner(videoElement, decoder, handleBarcode);
scanner.start();
function handleBarcode(barcode: IBarcode): void {
// Do something with the barcode...
}
// Scanner and decoder (when using included wasm decoder) must be disposed of properly to stop underlying running processes.
function teardown(): void {
scanner.stop();
decoder.dispose();
}
Include the submodule that checks the user's client for support, then lazily import a module using the scanner.
// lazy.ts
import { isBarcodeScannerSupported } from "@impactdk/barcode-scanner/lazy";
if (isBarcodeScannerSupported) {
const videoElement: HTMLVideoElement = document.getElementById("scanner-video");
import("./scanner-module")
.then(mod => ...);
} else {
console.log("Barcode scanner is not supported...");
}
// scanner-module.ts
import { WasmDecoder, Scanner, IBarcode } from "@impactdk/barcode-scanner";
...
FAQs
A barcode scanner module, using a webassembly module built on [ZBar](https://github.com/ZBar/ZBar), which supports a variety of different barcodes.
We found that @impactdk/barcode-scanner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.