Socket
Socket
Sign inDemoInstall

unix-print

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0-beta.1 to 1.3.0

2

package.json
{
"name": "unix-print",
"version": "1.3.0-beta.1",
"version": "1.3.0",
"description": "Utility for Unix-like operating systems to print PDF files from Node.js and Electron",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -17,3 +17,4 @@ # Unix-print

- [API](#api)
- [`print(pdf, printer, options) => Promise<void>`](#printpdf-printer-options--promisevoid)
- [`print(pdf, printer, options) => Promise<{stdout, stderr}>`](#printpdf-printer-options--promisevoid)
- [`isPrintComplete(printResponse) => Promise<boolean>`](#isprintcompleteprintresponse--promiseboolean)
- [`getPrinters() => Promise<Printer[]>`](#getprinters--promiseprinter)

@@ -65,3 +66,3 @@ - [`getDefaultPrinter() => Promise<Printer | null>`](#getdefaultprinter--promiseprinter--null)

`Promise<void>`.
`Promise<{stdout: string | null, stderr: string | null}>`.

@@ -99,2 +100,33 @@ To print a file to the default printer:

### `isPrintComplete(printResponse) => Promise<boolean>`
**Arguments**
| Argument | Type | Optional | Description |
| ------------- | :---------------------------------------: | -------- | ------------------------------ |
| printResponse | <code>{stdout: string &#124; null}</code> | Required | Promise returned from [`print`](#printpdf-printer-options--promisevoid). |
**Returns**
`Promise<boolean>`: False if the job is on the queue or `stdout` is null, true otherwise.
**Examples**
```javascript
import { isComplete } from 'unix-print';
const fileToPrint = 'assets/file.pdf';
const printJob = print(fileToPrint);
async function waitForPrintCompletion(printJob) {
while (!await isPrintComplete(printJob)) {
// Wait a bit before checking again (to avoid constant checks)
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for 1 second
}
console.log('Job complete');
}
await waitForPrintCompletion(printJob);
```
### `getPrinters() => Promise<Printer[]>`

@@ -101,0 +133,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc