Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bwip-js

Package Overview
Dependencies
Maintainers
0
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bwip-js

JavaScript barcode generator supporting over 100 types and standards.

  • 4.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
108K
decreased by-16.87%
Maintainers
0
Weekly downloads
 
Created

What is bwip-js?

bwip-js is a comprehensive barcode generation library for Node.js and the browser. It supports over 100 different barcode formats, including linear barcodes, postal barcodes, and 2D barcodes. The library is built on top of the BWIPP (Barcode Writer in Pure PostScript) project, ensuring high-quality and accurate barcode generation.

What are bwip-js's main functionalities?

Generate Linear Barcodes

This feature allows you to generate linear barcodes such as Code 128. The code sample demonstrates how to create a Code 128 barcode with specific text, scaling, height, and text alignment.

const bwipjs = require('bwip-js');
bwipjs.toBuffer({
    bcid: 'code128',       // Barcode type
    text: '0123456789',    // Text to encode
    scale: 3,              // 3x scaling factor
    height: 10,            // Bar height, in millimeters
    includetext: true,     // Show human-readable text
    textxalign: 'center',  // Always good to set this
}, function (err, png) {
    if (err) {
        // `err` may be a string or Error object
        console.log(err);
    } else {
        // `png` is a Buffer
        // png.length
        // png.readUInt32BE(16)
    }
});

Generate 2D Barcodes

This feature allows you to generate 2D barcodes such as QR codes. The code sample demonstrates how to create a QR code with specific text, scaling, version, and text alignment.

const bwipjs = require('bwip-js');
bwipjs.toBuffer({
    bcid: 'qrcode',        // Barcode type
    text: 'https://www.example.com', // Text to encode
    scale: 3,              // 3x scaling factor
    version: 5,            // QR Code version
    includetext: true,     // Show human-readable text
    textxalign: 'center',  // Always good to set this
}, function (err, png) {
    if (err) {
        // `err` may be a string or Error object
        console.log(err);
    } else {
        // `png` is a Buffer
        // png.length
        // png.readUInt32BE(16)
    }
});

Generate Postal Barcodes

This feature allows you to generate postal barcodes such as USPS Intelligent Mail. The code sample demonstrates how to create a USPS Intelligent Mail barcode with specific text, scaling, height, and text alignment.

const bwipjs = require('bwip-js');
bwipjs.toBuffer({
    bcid: 'usps4cb',       // Barcode type
    text: '01234567094987654321', // Text to encode
    scale: 3,              // 3x scaling factor
    height: 10,            // Bar height, in millimeters
    includetext: true,     // Show human-readable text
    textxalign: 'center',  // Always good to set this
}, function (err, png) {
    if (err) {
        // `err` may be a string or Error object
        console.log(err);
    } else {
        // `png` is a Buffer
        // png.length
        // png.readUInt32BE(16)
    }
});

Other packages similar to bwip-js

Keywords

FAQs

Package last updated on 13 Aug 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc