Add typing for barcode

This commit is contained in:
Pascal Vomhoff
2015-11-01 19:48:02 +01:00
parent eb59a40d3c
commit 1c4e79f075
2 changed files with 47 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
/// <reference path="barcode.d.ts" />
import barcode = require('barcode');
import path = require('path');
var code39 = barcode('code39', {
data: "it works",
width: 400,
height: 100,
});
code39.getStream(function (err, readStream) {
if (err) throw err;
// 'readStream' is an instance of ReadableStream
});
var outfile = path.join(__dirname, 'imgs', 'mycode.png');
code39.saveImage(outfile, function (err) {
if (err) throw err;
console.log('File has been written!');
});