
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
This project rocks and uses MIT-LICENSE.
This project is for modular of BWIP library. It supports packages for nodejs, bower & rails.
As a gem for rails provides:
As a package for nodejs provides:
As a package for bower provides:
We are here to serve : Hatio, Lab.
You just try to show simple barcode image by request.
npm install bwip
var bwip = require('bwip');
var bcid = 'code128';
var wscale = 4;
var hscale = 4;
var rotate = 'L';
var text = '^FNC1011234567890';
var options = {
alttext: '(01)01234567890',
parsefnc: true
};
var png = bwip.png(bcid, text, wscale, hscale, rotate, options);
var url = require('url');
var http = require('http');
var bwip = require('bwip');
function error(res, status, message) {
res.writeHead(status, { 'Content-Type':'text/plain' });
res.end(message, 'ascii');
}
http.createServer(function(req, res) {
var args = url.parse(req.url, true).query;
// Set the defaults
var wscale = parseInt(args.wscale, 10) || 2;
var hscale = parseInt(args.hscale, 10) || 2;
var rotate = args.rotate || 'N';
var bcid = args.bcid;
var text = args.text;
if (!text)
return error(res, 400, 'Bar code text not specified.\r\n');
if (!bcid)
return error(res, 400, 'Bar code type not specified.\r\n');
// Remove the non-BWIPP options
delete args.wscale;
delete args.hscale;
delete args.rotate;
delete args.text;
delete args.bcid;
// Return a PNG-encoded image
var png = bwip.png(bcid, text, wscale, hscale, rotate, args);
res.writeHead(200, { 'Content-Type':'image/png' });
res.end(png, 'binary');
}).listen(3030);
gem "bwip"
And run bundle install
. The rest of the installation depends on
whether the asset pipeline is being used.
The bwip files will be added to the asset pipeline and available for you to use. If they're not already in app/assets/javascripts/application.js
by default, add these lines:
//= require bwip-min
function : bwip.png(bcid, text, wscale, hscale, rotate, options);
'bcid' is the name of the bwip-js barcode rendering function e.g.
'text' is the text to be bar coded.
'wscale' is an integer value from 1 .. 10. Default is 2.
'hscale' is an integer value from 1 .. 10. Default is 2.
'rotate' takes the values: N normal, unrotated (the default) R clockwise, 90 rotation L counter-clockwise, 90 rotation I inverted, 180 rotation
'options' is the object what can take any of the bar code options defined in the BWIPP documentation.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Feel free to open an issue ticket if you find something that could be improved. A couple notes:
[before 0.7]
bwip.png(bcid, text, scale, rotate, options)
bwip.base64(bcid, text, scale, rotate, options)
[after 0.7]
bwip.png(bcid, text, wscale, hscale, rotate, options)
bwip.base64(bcid, text, wscale, hscale, rotate, options)
Copyright (c) 2014 Hatio, Lab. Licensed under the MIT license.
FAQs
BWIP for node-js
The npm package bwip receives a total of 12 weekly downloads. As such, bwip popularity was classified as not popular.
We found that bwip 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.