I want to extract the price value from the GS1 data martix QR code value using Nodejs. Using the module
npm i gs1-barcode-parser
Tried the below throwing "parseBarcode" is not a function
const { parseBarcode } = require('gs1-barcode-parser');
let barcode = '\u001d01093393871222863922001405\u001d1522030631030006691095751410';
console.log(parseBarcode(barcode));
I would use the modded module gs1-barcode-parser-mod2
const parser = require("gs1-barcode-parser-mod2")
let barcode = ']C101040123456789011715012910ABC1233932978471131030005253922471142127649716';
console.log(parser.parseBarcode(barcode));
Unfortunately your barcode seems to be invalid. You will need to decode from UTF-8 as that would result in ∞01093393871222863922001405∞1522030631030006691095751410 even then your barcode seems to have a missing prefix, called an Application Identifier or for short, AI (]xxxxx..).
A valid barcode example is given in the code snippet above.
More info about application identifiers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With