{"id":15998313,"url":"https://github.com/yushulx/barcode4nodejs","last_synced_at":"2025-09-23T17:29:34.337Z","repository":{"id":45599511,"uuid":"143980200","full_name":"yushulx/barcode4nodejs","owner":"yushulx","description":"Node.js 1D/2D barcode detection SDK built with Dynamsoft Barcode Reader.","archived":false,"fork":false,"pushed_at":"2024-11-06T06:08:17.000Z","size":289106,"stargazers_count":27,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-06T06:12:01.191Z","etag":null,"topics":["barcode","barcode-reader","barcode-scanner","camera","code128","code39","cpp","datamatrix","ean13","javascript","node-red","nodejs","opencv","pdf417","qrcode","qrcode-reader","webcam"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/barcode4nodejs","language":"C++","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/yushulx.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":"2018-08-08T07:56:32.000Z","updated_at":"2024-11-06T06:07:45.000Z","dependencies_parsed_at":"2023-07-20T01:01:34.023Z","dependency_job_id":"e4919ba9-ac4d-40cb-9fdf-f1aac9dcdb3b","html_url":"https://github.com/yushulx/barcode4nodejs","commit_stats":{"total_commits":73,"total_committers":2,"mean_commits":36.5,"dds":"0.013698630136986356","last_synced_commit":"3aadb5efa4501552dbf947fd96497ca42f183b97"},"previous_names":["dynamsoft-dbr/nodejs","yushulx/barcode4nodejs","yushulx/nodejs-barcode"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2Fbarcode4nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2Fbarcode4nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2Fbarcode4nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2Fbarcode4nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yushulx","download_url":"https://codeload.github.com/yushulx/barcode4nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245611757,"owners_count":20643892,"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-reader","barcode-scanner","camera","code128","code39","cpp","datamatrix","ean13","javascript","node-red","nodejs","opencv","pdf417","qrcode","qrcode-reader","webcam"],"created_at":"2024-10-08T08:08:27.293Z","updated_at":"2025-09-23T17:29:34.331Z","avatar_url":"https://github.com/yushulx.png","language":"C++","readme":"# Node.js Barcode \u0026 QR Code SDK\nThe Node.js barcode QR code SDK is implemented by wrapping [Dynamsoft Barcode Reader C++ SDK](https://www.dynamsoft.com/barcode-reader/overview/). It helps developers to build Node.js barcode and QR code scanning applications for **Windows**, **Linux**, **macOS**, **Raspberry Pi** and **Jetson Nano**.\n\n\n## License Key for SDK\n[![](https://img.shields.io/badge/Get-30--day%20FREE%20Trial-blue)](https://www.dynamsoft.com/customer/license/trialLicense/?product=dcv\u0026package=cross-platform)\n\n\n## Pre-requisites\n- Platform-specific C/C++ compiler\n- node-gyp\n\n    ```\n    npm i node-gyp -g\n    npm i node-addon-api -g\n    ```\n\n## Supported Platforms\n- **Windows**\n- **Linux**\n- **macOS**\n\n## Supported Barcode Symbologies\n- Linear Barcodes (1D)\n  - Code 39 (including Code 39 Extended)\n  - Code 93\n  - Code 128\n  - Codabar\n  - Interleaved 2 of 5\n  - EAN-8\n  - EAN-13\n  - UPC-A\n  - UPC-E\n  - Industrial 2 of 5\n\n- 2D Barcodes\n  - QR Code (including Micro QR Code and Model 1)\n  - Data Matrix\n  - PDF417 (including Micro PDF417)\n  - Aztec Code\n  - MaxiCode (mode 2-5)\n  - DotCode\n\n- Patch Code\n- GS1 Composite Code\n- GS1 DataBar\n  - Omnidirectional,\n  - Truncated, Stacked, Stacked\n  - Omnidirectional, Limited,\n  - Expanded, Expanded Stacked\n\n- Postal Codes\n  - USPS Intelligent Mail\n  - Postnet\n  - Planet\n  - Australian Post\n  - UK Royal Mail\n\n## API\n- `initLicense(license: string): void`\n- `createInstance(): BarcodeReader`\n- `getVersion(): string`\n\n**Asynchronous Methods**\n- `decodeFileAsync(filePath: string, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) =\u003e void, template?: string): void`\n- `decodeFileAsync(filePath: string, format: formats, template?: string): Promise\u003cBarcodeResult[]\u003e`\n- `decodeFileStreamAsync(stream: any, length: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) =\u003e void, template?: string): void`\n- `decodeFileStreamAsync(stream: any, length: number, format: formats, template?: string): Promise\u003cBarcodeResult[]\u003e`\n- `decodeBase64Async(base64String: string, format: formats, callback: (err: Error | null, result?: BarcodeResult[]) =\u003e void, template?: string): void`\n- `decodeBase64Async(base64String: string, format: formats, template?: string): Promise\u003cBarcodeResult[]\u003e`\n- `decodeYUYVAsync(data: any, width: number, height: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) =\u003e void, template?: string): void`\n- `decodeYUYVAsync(data: any, width: number, height: number, format: formats, template?: string): Promise\u003cBarcodeResult[]\u003e`\n- `decodeBufferAsync(buffer: any, width: number, height: number, stride: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) =\u003e void, template?: string): void`\n- `decodeBufferAsync(buffer: any, width: number, height: number, stride: number, format: formats, template?: string): Promise\u003cBarcodeResult[]\u003e`\n\n## Quick Usage\nReplace `LICENSE-KEY` with your own license key.\n\n```js\nconst dbr = require('barcode4nodejs');\ndbr.initLicense(\"LICENSE-KEY\")\ndbr.decodeFileAsync(\"YOUR IMAGE FILE\", dbr.formats.ALL, function(err, msg){\n  console.log(msg);\n  for (index in msg) {\n    result = msg[index];\n    console.log('Format: ' + result['format']);\n    console.log('Value : ' + result['value']);\n    console.log('x1: ' + result['x1']);\n    console.log('y1 : ' + result['y1']);\n    console.log('x2: ' + result['x2']);\n    console.log('y2 : ' + result['y2']);\n    console.log('x3: ' + result['x3']);\n    console.log('y3: ' + result['y3']);\n    console.log('x4: ' + result['x4']);\n    console.log('y4: ' + result['y4']);\n    console.log('page: ' + result['page']);\n    console.log('decoding time: ' + result['time']);\n  }\n}, \"\");\n\n// Or\n(async function () {\n  try {\n    var result = await dbr.decodeFileAsync(\"YOUR IMAGE FILE\", dbr.formats.ALL, \"\");\n    console.log(result);\n  } catch (error) {\n    console.log(error);\n  }\n})();\n```\n\n## How to Customize and Build the Module \n\n1. Get the source code:\n\n    ```\n    git clone https://github.com/yushulx/nodejs-barcode.git\n    ``` \n\n2. Download Dynamsoft C++ Barcode SDK. Copy header files to `src` folder and copy platform-specific shared libraries to `platforms` folder.\n3. Edit `src/dbr.cc` and `index.js`.\n4. Build the Node.js extension:\n\n    ```bash\n    node-gyp configure\n    node-gyp build\n\n    # For macOS\n    install_name_tool -change @rpath/libDynamsoftCore.dylib @loader_path/libDynamsoftCore.dylib build/Release/dbr.node\n    install_name_tool -change @rpath/libDynamsoftLicense.dylib @loader_path/libDynamsoftLicense.dylib build/Release/dbr.node\n    install_name_tool -change @rpath/libDynamsoftCaptureVisionRouter.dylib @loader_path/libDynamsoftCaptureVisionRouter.dylib build/Release/dbr.node\n    install_name_tool -change @rpath/libDynamsoftUtility.dylib @loader_path/libDynamsoftUtility.dylib build/Release/dbr.node\n    install_name_tool -change @rpath/libDynamsoftImageProcessing.dylib @loader_path/libDynamsoftImageProcessing.dylib build/Release/libDynamsoftUtility.dylib\n    ```\n\n    **For Visual Studio 2019 Community**\n\n    ```\n    node-gyp configure --msbuild_path=\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe\" --msvs_version=2017\n    node-gyp build\n    ```\n\n## Examples    \n- [Command Line](./examples/command-line/)\n\n    ```\n    node test.js -f MultiPage.pdf\n    ```\n\n    ![image](https://github.com/yushulx/nodejs-barcode/assets/2202306/897ab95a-6d94-4e58-9a3f-ab040ea48240)\n\n    \n- [Web](./examples/web/)\n\n    ```\n    npm install\n    node server.js\n    ```\n    Open `http://localhost:2018/index.htm` in web browsers.\n\n- [Desktop Electron](./examples/desktop-electron/)\n\n    ```\n    cd src\n    node-gyp rebuild --target=0.36.7 --arch=x64 --dist-url=https://atom.io/download/atom-shell\n\n    cd examples/desktop-electron\n    npm install\n    npm start\n    ```\n\n- [Linux Camera](./examples/linux-camera/)\n\n    ```\n    npm install v4l2camera\n    node camera_barcode_reader.js\n    ```\n\n- [RESTful Service](./examples/RESTful-service/)\n\n    ```\n    npm install restify\n    node server.js\n    ```\n    \n    Open `https://\u003c ip \u003e:2018` to scan barcodes in web browsers.\n\n- [Litecamera](./examples/litecamera/)\n- [Node-RED](./examples/node-red/)\n\n    ![Node RED barcode](https://www.dynamsoft.com/codepool/img/2018/11/node-red-debug.PNG)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyushulx%2Fbarcode4nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyushulx%2Fbarcode4nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyushulx%2Fbarcode4nodejs/lists"}