0.2.1 โ€ข Published 3 years ago

@h0me/tp-server v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

๐Ÿงพtp-server

A Thermal Printer server and MQTT client providing a markup-like api interface around the `escpos' library.

An example HTTP request would look like...

POST /job HTTP/1.1
Host: 192.168.1.23:3000
Content-Type: text/plain

font "a"
size "2" "2"
align "ct"
style "bu"
text "Hi!"
size "0" "0"
text "A little test print for you!"
text "Have a barcode"
barcode "1234567" "EAN8"
cut

More commands can be found at the escpos repo.

๐Ÿƒโ€โ™€๏ธ Run the server

To start the server, you can install globally, or use npx

npm install -g @h0me/tp-server
tp-server examples/config.js
npx @h0me/tp-server examples/config.js

๐Ÿ–จ๏ธ Print!

HTTP

curl --location --request POST 'http://192.168.1.23:3000/job' \
--header 'Content-Type: text/plain' \
--data-raw 'font "a"
size "2" "2"
text "Hi!"
cut'

MQTT

mqtt pub -t "h0me/tp-server" -m 'font "a"
size "2" "2"
text "Hi!"
cut'