![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
barcode-bakery-1d
Advanced tools
Barcode Bakery is library written in Node.JS, .NET Standard and PHP which allows you to generate barcodes on the fly on your server for displaying or saving.
The library has minimal dependencies in each language in order to be supported on a wide variety of web servers.
The library is available for free for non-commercial use; however you must purchase a license if you plan to use it in a commercial environment.
There are two ways to install our library:
$ npm install barcode-bakery-1d
For a full example of how to use each symbology type, visit our API page.
import { BCGColor, BCGDrawing, BCGFont } from 'barcode-bakery-common';
import { BCGcode128 } from 'barcode-bakery-1d';
use BarcodeBakery\Common\BCGFontFile;
use BarcodeBakery\Common\BCGColor;
use BarcodeBakery\Common\BCGDrawing;
use BarcodeBakery\Barcode\BCGcode128;
let font = new BCGFontFile('Arial', 18);
let colorFront = new BCGColor(0, 0, 0);
let colorBack = new BCGColor(255, 255, 255);
// Barcode Part
let code = new BCGcode128();
code.setScale(2); // Resolution
code.setThickness(30); // Thickness
code.setBackgroundColor(colorWhite); // Color of spaces
code.setForegroundColor(colorBlack); // Color of bars
code.setFont(font); // Font (or 0)
code.setStart(null);
code.setTilde(true);
code.parse('a123'); // Text
let drawing = new BCGDrawing(code, colorWhite);
drawing.toBuffer(BCGDrawing.ImageFormat.Png, function (err, buffer) {
response.writeHead(200, { 'Content-Type': 'image/png' });
response.end(buffer);
});
Replace the last line of the previous code with the following:
var drawing = new BCGDrawing(code, colorBack);
drawing.save('image.png', BCGDrawing.ImageFormat.Png, function() {
console.log('Done.');
});
This will generate the following:
Both save
and toBuffer
have counterparts acting synchronously: saveSync
and toBufferSync
.
Simply type npm test
to run the tests.
FAQs
Generates 1D barcodes from Node server to a file or a buffer.
The npm package barcode-bakery-1d receives a total of 1 weekly downloads. As such, barcode-bakery-1d popularity was classified as not popular.
We found that barcode-bakery-1d demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.