Created
August 29, 2016 02:57
-
-
Save renatoargh/7baec3926d93bf4a0d5876fc7aef334c to your computer and use it in GitHub Desktop.
Imprimindo com Bematech MP-4200 com node.js (sem cups nem módulos nativos)
This file contains 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'); | |
String.prototype.toBytes = function() { | |
var arr = [] | |
for (var i=0; i < this.length; i++) { | |
arr.push(this[i].charCodeAt(0)) | |
} | |
return arr; | |
} | |
var printData = "Hello World!".toBytes().concat([0x01B, 0x64, 10, 0x1d, 0x56, 0x00]); | |
var wstream = fs.createWriteStream('/dev/ttyACM0', { | |
encoding: 'utf16le' | |
}); | |
wstream.write(new Buffer(printData)); | |
wstream.end(); |
Opa, nao faço ideia como funciona no Windows
…On Wed, Oct 7, 2020, 00:11 Patrique ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
@renatoargh <https://github.com/renatoargh> no windows basta eu inserir
COM01 no createwritestream? estou tentando e nada, estou fazendo algo de
errado ou em windows não rola?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/7baec3926d93bf4a0d5876fc7aef334c#gistcomment-3479921>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD7OO5SLACDFU3OTDXWXLDSJOIYVANCNFSM4SGTNL7Q>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@renatoargh no windows basta eu inserir COM01 no createwritestream? estou tentando e nada, estou fazendo algo de errado ou em windows não rola?