Created
April 22, 2016 16:48
-
-
Save katylava/d1aff55b00e488341ed389732bbb10bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var request = require('request'); | |
request.post({ body: "^xa^cfa,50^fo100,100^fdHello World^fs^xz", encoding: null, url: 'http://api.labelary.com/v1/printers/8dpmm/labels/4x6.75/0/' }, function(err, resp, body) { | |
if (err) { | |
return console.log(err); | |
} | |
console.log('headers', resp.headers); | |
console.log('status', resp.statusCode); | |
console.log('body', body); | |
if (body.length < 1000) { | |
console.log(new Buffer(body).toString()); | |
} | |
fs.writeFile('./label.png', body, function(err) { | |
if (err) { | |
console.log(err); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
console output: