Barcode Xpress for Node.js v14.0 - Updated
Getting Started / Upgrading from Barcode Xpress v11 to v13
In This Topic
    Upgrading from Barcode Xpress v11 to v13
    In This Topic

    Upgrading the Package

    1. Make sure you have the correct system requirements.
    2. If you already have barcode-js installed, you can use the following npm command to upgrade to the latest version:
    $ npm install barcode-js@latest
    
    

    Use the -g flag if you have barcode-js installed as a global package.

    Note that going from v11 to v13 is a major version upgrade, so the npm install command must be used.

    For minor version updates, you can use npm update instead.

    Updating Your Code

    As of version 13, the parameters of the bx.analyze() function have changed.

    • The input image is now specified as a separate, new first parameter, and should no longer be specified in the params object.
    • The remaining processing parameters are still passed in the object.

    For the type parameter, it is preferable to use the predefined BarcodeType constants instead of strings.

    Before:

    JavaScript

    // barcode-js v11
     const bx = require('barcode-js');
     const params = {
        input: "path/filename.ext",
        type: ["code128", "code39"]
    }
    bx.analyze(params, function(err, results) {
        /* ... */
    });
    
    

    Now:

    JavaScript

    // barcode-js v13
    const bx = require('barcode-js');
    const params = {
        type: [bx.BarcodeType.CODE128, bx.BarcodeType.CODE39]
    }
    const input = "path/filename.ext";
    bx.analyze(input, params, function(err, results) {
        /* ... */
    });
    
    

    You will need to update your existing code to reflect this change.

    See the documentation of the analyze function for more information.