2.0.2 • Published 2 years ago
little-print v2.0.2
little-print
A dependency-free wrapper for Nord Projects' Device Keys API for Little Printer.
Usage
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.
printHTML(html: String)
Prints a provided HTML document.
Input
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 careOutput

printImage(path: Path)
Prints a GIF, JPEG, or PNG image.
Input
await printer.printImage("./first_time.jpg");
// returns {statusCode, headers, body}Output

printText(text: String)
Prints a provided string.
Input
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}Output
