https://github.com/montyanderson/lineprinter
Print to USB line printers from Node
https://github.com/montyanderson/lineprinter
Last synced: 3 months ago
JSON representation
Print to USB line printers from Node
- Host: GitHub
- URL: https://github.com/montyanderson/lineprinter
- Owner: montyanderson
- License: mit
- Created: 2017-07-27T13:03:27.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-27T14:36:55.000Z (almost 8 years ago)
- Last Synced: 2025-02-18T22:46:19.658Z (4 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lineprinter
Print to USB line printers from Node

## Usage
``` javascript
const LinePrinter = require("lineprinter");
const printer = await LinePrinter.auto();await printer.println("Hello, World!");
```### API
#### async LinePrinter.list()
Returns the list of printers currently connected.
``` javascript
await LinePrinter.list();
// [ "lp0" ]
```#### async LinePrinter.connect(device)
Returns a new `LinePrinter` connected to the printer.
``` javascript
const printer = await LinePrinter.connect("lp0");
```#### async LinePrinter.auto()
Returns a `LinePrinter` connected to the first printer found.
``` javascript
const printer = await LinePrinter.auto();
```#### async LinePrinter#print(data)
Prints `data` to the printer. Can be a `String` or `Buffer`.
``` javascript
await printer.print("Hello");
```#### async LinePrinter#println(data)
Prints `data` to the printer, followed by a line break.
``` javascript
await printer.println("Hello, World!");
```