A dependency-free wrapper for Nord Projects' Device Keys API for Little Printer.
Instantiate a LittlePrint
class:
import LittlePrint from "little-print";
const printer = new LittlePrint({
deviceKey: "abcd1234", // required
appName: "README", // optional
});
Your deviceKey
is everything following device.li/
on Nord Projects' Device Keys website.
Prints a provided HTML document.
await printer.printHTML(`
<em>*slaps roof of printer*</em>
<h1>You can fit</h1>
<ul>
<li>so</li>
<li>much</li>
<li>markup</li>
</ul>
<h2>in this bad boy!</h2>
`);
// returns {statusCode, headers, body}, if you care
Prints a GIF, JPEG, or PNG image.
await printer.printImage("./first_time.jpg");
// returns {statusCode, headers, body}
Prints a provided string.
await printer.printText(
`The story begins in any of the three dozen taquerias supplying the Bay Area Feeder Network, an expansive spiderweb of tubes running through San Francisco's Mission district as far south as the "Burrito Bordeaux" region of Palo Alto and Mountain View.`,
);
// returns {statusCode, headers, body}