New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

barcode-bakery-1d

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

barcode-bakery-1d - npm Package Compare versions

Comparing version 0.0.1 to 2.0.0-alpha.1

dist/BCGcodabar.d.ts

4

LICENSE.md

@@ -5,6 +5,6 @@ Barcode Bakery 1D for NodeJS has two possible licenses.

(a paid license, meant for commercial use)
http://www.barcodebakery.com/en/license/2
https://www.barcodebakery.com/en/license/2
- Creative Commons Non-Commercial No-Derivatives
(meant for trial and non-commercial use)
https://creativecommons.org/licenses/by-nc-nd/4.0/
https://creativecommons.org/licenses/by-nc-nd/4.0/
{
"name": "barcode-bakery-1d",
"version": "0.0.1",
"version": "2.0.0-alpha.1",
"description": "Generates 1D barcodes from Node server to a file or a buffer.",
"main": "./index.js",
"homepage": "http://www.barcodebakery.com",
"homepage": "https://www.barcodebakery.com",
"author": {

@@ -33,8 +32,20 @@ "name": "Jean-Sébastien Goupil",

"license": "See LICENSE.MD",
"scripts": {
"test": "mocha --require ts-node/register 'test/**/*.ts'"
},
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"/dist"
],
"dependencies": {
"barcode-bakery-common": "0.0.1"
"barcode-bakery-common": "2.0.0-alpha.1"
},
"devDependencies": {
"mocha": "^2.4.5"
"@tsconfig/node14": "^1.0.0",
"@types/mocha": "^8.2.2",
"mocha": "^2.4.5",
"ts-node": "^9.1.1",
"typescript": "^4.2.4"
}
}
}

@@ -1,95 +0,131 @@

# Barcode Bakery 1D
<p align="center"><a href="https://www.barcodebakery.com" target="_blank">
<img src="https://www.barcodebakery.com/images/BCG-Logo-SQ-GitHub.svg">
</a></p>
Generate 1D barcode used for tracking.
[Barcode Bakery][1] is library written in Node.JS, [.NET Standard][32] and [PHP][33] which allows you to generate barcodes on the fly on your server for displaying or saving.
## Supported 1D types
The library has minimal dependencies in each language in order to be supported on a wide variety of web servers.
* [Codabar](http://www.barcodebakery.com/en/resources/api/nodejs/codabar)
* [Code 11](http://www.barcodebakery.com/en/resources/api/nodejs/code11)
* [Code 128](http://www.barcodebakery.com/en/resources/api/nodejs/code128)
* [Code 39](http://www.barcodebakery.com/en/resources/api/nodejs/code39)
* [Code 39 Extended](http://www.barcodebakery.com/en/resources/api/nodejs/code39extended)
* [Code 93](http://www.barcodebakery.com/en/resources/api/nodejs/code93)
* [EAN-13](http://www.barcodebakery.com/en/resources/api/nodejs/ean13)
* [EAN-8](http://www.barcodebakery.com/en/resources/api/nodejs/ean8)
* [Interleaved 2 of 5](http://www.barcodebakery.com/en/resources/api/nodejs/i25)
* [ISBN](http://www.barcodebakery.com/en/resources/api/nodejs/isbn)
* [MSI](http://www.barcodebakery.com/en/resources/api/nodejs/msi)
* [Standard 2 of 5](http://www.barcodebakery.com/en/resources/api/nodejs/s25)
* [UPC-A](http://www.barcodebakery.com/en/resources/api/nodejs/upca)
* [UPC-E](http://www.barcodebakery.com/en/resources/api/nodejs/upce)
* [UPC Extension 2](http://www.barcodebakery.com/en/resources/api/nodejs/upcext2)
* [UPC Extension 5](http://www.barcodebakery.com/en/resources/api/nodejs/upcext5)
* [Custom barcode](http://www.barcodebakery.com/en/resources/api/nodejs/othercode)
The library is available for free for non-commercial use; however you must [purchase a license][2] if you plan to use it in a commercial environment.
## Requirements
Installation
------------
There are two ways to install our library:
- [node-canvas](https://github.com/Automattic/node-canvas).
- node >= 4.2.6
* With composer, run the following command:
```bash
$ npm install barcode-bakery-1d
```
* Or, download the library on our [website][3], and follow our [developer's guide][4].
## Installation
Requirements
------------
* [node-canvas](https://github.com/Automattic/node-canvas). Version 2+
* node >= 14+
npm install barcode-bakery-1d
Example usages
--------------
For a full example of how to use each symbology type, visit our [API page][5].
## Example
### Displaying a Code 128 on the screen
```javascript
import { BCGColor, BCGDrawing, BCGFont } from 'barcode-bakery-common';
import { BCGcode128 } from 'barcode-bakery-1d';
Each barcodes can be reached from the `barcode-bakery-1d` package.
Each barcode has different methods that can be used to change its size, color, etc. Check the manual to get more information.
use BarcodeBakery\Common\BCGFontFile;
use BarcodeBakery\Common\BCGColor;
use BarcodeBakery\Common\BCGDrawing;
use BarcodeBakery\Barcode\BCGcode128;
```javascript
var barcodeBakeryCommon = require('barcode-bakery-common');
var barcodeBakery1D = require('barcode-bakery-1d');
var Color = barcodeBakeryCommon.Color;
var Drawing = barcodeBakeryCommon.Drawing;
var Font = barcodeBakeryCommon.Font;
let font = new BCGFontFile('Arial', 18);
let colorFront = new BCGColor(0, 0, 0);
let colorBack = new BCGColor(255, 255, 255);
// The arguments are R, G, B for color.
var colorFront = new Color(0, 0, 0);
var colorBack = new Color(255, 255, 255);
var code = new barcodeBakery1D.Code39();
// Barcode Part
let code = new BCGcode128();
code.setScale(2); // Resolution
code.setThickness(30); // Thickness
code.setBackgroundColor(colorBack); // Color of spaces
code.setForegroundColor(colorFront); // Color of bars
code.setBackgroundColor(colorWhite); // Color of spaces
code.setForegroundColor(colorBlack); // Color of bars
code.setFont(font); // Font (or 0)
code.parse("HELLO"); // Text
```
code.setStart(null);
code.setTilde(true);
code.parse('a123'); // Text
### Save to disk
```javascript
var drawing = new Drawing(code, colorBack);
drawing.save("image.png", Drawing.IMG_FORMAT_PNG, function() {
console.log("Done.");
let drawing = new BCGDrawing(code, colorWhite);
drawing.toBuffer(BCGDrawing.ImageFormat.Png, function (err, buffer) {
response.writeHead(200, { 'Content-Type': 'image/png' });
response.end(buffer);
});
```
### Get buffer
### Saving the image to a file
Replace the last line of the previous code with the following:
```javascript
var drawing = new Drawing(code, colorBack);
drawing.toBuffer(Drawing.IMG_FORMAT_PNG, function (err, buffer) {
response.writeHead(200, { "Content-Type": "image/png" });
response.end(buffer);
var drawing = new BCGDrawing(code, colorBack);
drawing.save('image.png', BCGDrawing.ImageFormat.Png, function() {
console.log('Done.');
});
```
This will generate the following:
<br />
<img src="https://www.barcodebakery.com/images/code-128-github.png">
### Sync methods
Both `save` and `toBuffer` have counterparts acting synchronously: `saveSync` and `toBufferSync`.
## Complete manual
See a complete manual for each barcode on our website http://www.barcodebakery.com.
## Tests
Simply type `mocha` to run the tests.
Simply type `npm test` to run the tests.
## License
Barcode Bakery 1D for NodeJS has two possible licenses.
Supported types
---------------
* [Codabar][6]
* [Code 11][7]
* [Code 128][8]
* [Code 39][9]
* [Code 39 Extended][10]
* [Code 93][11]
* [EAN-13][12]
* [EAN-8][13]
* [Interleaved 2 of 5][16]
* [ISBN-10 / ISBN-13][17]
* [MSI Plessey][18]
* [Other (Custom)][19]
* [Standard 2 of 5][21]
* [UPC Extension 2][22]
* [UPC Extension 5][23]
* [UPC-A][24]
* [UPC-E][25]
- Commercial License
(a paid license, meant for commercial use)
http://www.barcodebakery.com/en/license/2
Other libraries available for purchase
--------------------------------------
* [PDF417][30]
- Creative Commons Non-Commercial No-Derivatives
(meant for trial and non-commercial use)
https://creativecommons.org/licenses/by-nc-nd/4.0/
[1]: https://www.barcodebakery.com
[2]: https://www.barcodebakery.com/en/purchase
[3]: https://www.barcodebakery.com/en/download
[4]: https://www.barcodebakery.com/en/docs/nodejs/guide
[5]: https://www.barcodebakery.com/en/docs/nodejs/barcode/1d
[6]: https://www.barcodebakery.com/en/docs/nodejs/barcode/codabar/api
[7]: https://www.barcodebakery.com/en/docs/nodejs/barcode/code11/api
[8]: https://www.barcodebakery.com/en/docs/nodejs/barcode/code128/api
[9]: https://www.barcodebakery.com/en/docs/nodejs/barcode/code39/api
[10]: https://www.barcodebakery.com/en/docs/nodejs/barcode/code39extended/api
[11]: https://www.barcodebakery.com/en/docs/nodejs/barcode/code93/api
[12]: https://www.barcodebakery.com/en/docs/nodejs/barcode/ean13/api
[13]: https://www.barcodebakery.com/en/docs/nodejs/barcode/ean8/api
[16]: https://www.barcodebakery.com/en/docs/nodejs/barcode/i25/api
[17]: https://www.barcodebakery.com/en/docs/nodejs/barcode/isbn/api
[18]: https://www.barcodebakery.com/en/docs/nodejs/barcode/msi/api
[19]: https://www.barcodebakery.com/en/docs/nodejs/barcode/othercode/api
[21]: https://www.barcodebakery.com/en/docs/nodejs/barcode/s25/api
[22]: https://www.barcodebakery.com/en/docs/nodejs/barcode/upcext2/api
[23]: https://www.barcodebakery.com/en/docs/nodejs/barcode/upcext5/api
[24]: https://www.barcodebakery.com/en/docs/nodejs/barcode/upca/api
[25]: https://www.barcodebakery.com/en/docs/nodejs/barcode/upce/api
[30]: https://www.barcodebakery.com/en/docs/nodejs/barcode/pdf417/api
[32]: https://github.com/barcode-bakery/barcode-dotnet-1d/
[33]: https://github.com/barcode-bakery/barcode-php-1d/
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