{"id":16700010,"url":"https://github.com/artiebits/unix-print","last_synced_at":"2025-07-31T11:08:57.846Z","repository":{"id":37003374,"uuid":"407437061","full_name":"artiebits/unix-print","owner":"artiebits","description":"A utility for Unix-like operating systems to print files from Node.js and Electron.","archived":false,"fork":false,"pushed_at":"2023-11-24T07:45:52.000Z","size":454,"stargazers_count":97,"open_issues_count":3,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-25T18:57:53.485Z","etag":null,"topics":["electron","filesystem","linux","macos","nodejs","pdf","pdf-printer","png","printer","rollo-printer","unix","zebra-printer"],"latest_commit_sha":null,"homepage":"https://artiebits.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artiebits.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-17T06:51:45.000Z","updated_at":"2025-07-12T01:07:34.000Z","dependencies_parsed_at":"2024-06-18T19:58:43.329Z","dependency_job_id":"6a53e534-41a0-40b7-ae20-f4da7f58e962","html_url":"https://github.com/artiebits/unix-print","commit_stats":{"total_commits":18,"total_committers":6,"mean_commits":3.0,"dds":"0.38888888888888884","last_synced_commit":"44080f1e6deb90ad97170b1f554be187b7899802"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/artiebits/unix-print","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artiebits%2Funix-print","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artiebits%2Funix-print/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artiebits%2Funix-print/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artiebits%2Funix-print/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artiebits","download_url":"https://codeload.github.com/artiebits/unix-print/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artiebits%2Funix-print/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268026679,"owners_count":24183483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron","filesystem","linux","macos","nodejs","pdf","pdf-printer","png","printer","rollo-printer","unix","zebra-printer"],"created_at":"2024-10-12T18:08:54.562Z","updated_at":"2025-07-31T11:08:57.803Z","avatar_url":"https://github.com/artiebits.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unix-print\n\nA utility for Unix-like operating systems to print files from Node.js and Electron.\n\n- Understands different types of files, such as PDF, text, PostScript, and image files.\n- Supports label printers such as Rollo and Zebra.\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n**Table of Contents**\n\n- [Unix-print](#unix-print)\n  - [Basic Usage](#basic-usage)\n  - [Installation](#installation)\n  - [API](#api)\n    - [`print(pdf, printer, options) =\u003e Promise\u003c{stdout, stderr}\u003e`](#printpdf-printer-options--promisevoid)\n    - [`isPrintComplete(printResponse) =\u003e Promise\u003cboolean\u003e`](#isprintcompleteprintresponse--promiseboolean)\n    - [`getPrinters() =\u003e Promise\u003cPrinter[]\u003e`](#getprinters--promiseprinter)\n    - [`getDefaultPrinter() =\u003e Promise\u003cPrinter | null\u003e`](#getdefaultprinter--promiseprinter--null)\n  - [License](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Basic Usage\n\nPrint a PDF file to the default printer:\n\n```javascript\nimport { print } from \"unix-print\";\n\nprint(\"assets/file.pdf\").then(console.log);\n```\n\n## Installation\n\nInstall using Yarn:\n\n```bash\nyarn add unix-print\n```\n\nOr using npm:\n\n```bash\nnpm install --save unix-print\n```\n\n## API\n\n### `print(pdf, printer, options) =\u003e Promise\u003cvoid\u003e`\n\nA function to print a file to a printer.\n\n**Arguments**\n\n| Argument |    Type    | Optional | Description                                                             |\n| -------- | :--------: | -------- | ----------------------------------------------------------------------- |\n| file     |  `string`  | Required | A file to print.                                                        |\n| printer  |  `string`  | Optional | Print a file to the specific printer.                                   |\n| options  | `string[]` | Optional | Any option from [this list](https://www.computerhope.com/unix/ulp.htm). |\n\n**Returns**\n\n`Promise\u003c{stdout: string | null, stderr: string | null}\u003e`.\n\nTo print a file to the default printer:\n\n```javascript\nimport { print } from \"unix-print\";\n\nprint(\"assets/file.pdf\").then(console.log);\n```\n\nTo print a file to a specific printer:\n\n```javascript\nimport { print } from \"unix-print\";\n\nconst fileToPrint = \"assets/file.pdf\";\nconst printer = \"Zebra\";\n\nprint(fileToPrint, printer).then(console.log);\n```\n\nWith some printer-specific options:\n\n```javascript\nimport { print } from \"unix-print\";\n\nconst fileToPrint = \"assets/file.jpg\";\nconst printer = undefined;\nconst options = [\"-o landscape\", \"-o fit-to-page\", \"-o media=A4\"];\n\nprint(\"assets/file.jpg\", printer, options).then(console.log);\n```\n\n### `isPrintComplete(printResponse) =\u003e Promise\u003cboolean\u003e`\n\n**Arguments**\n\n| Argument      |                   Type                    | Optional | Description                    |\n| ------------- | :---------------------------------------: | -------- | ------------------------------ |\n| printResponse | \u003ccode\u003e{stdout: string \u0026#124; null}\u003c/code\u003e | Required | Resolved promise returned from [`print`](#printpdf-printer-options--promisevoid). |\n\n**Returns**\n\n`Promise\u003cboolean\u003e`: False if the job is on the queue or `stdout` is null, true otherwise.\n\n**Examples**\n\n```javascript\nimport { isPrintComplete } from 'unix-print';\n\nconst fileToPrint = 'assets/file.pdf';\nconst printJob = await print(fileToPrint);\n\nasync function waitForPrintCompletion(printJob) {\n  while (!await isPrintComplete(printJob)) {\n    // Wait a bit before checking again (to avoid constant checks)\n    await new Promise(resolve =\u003e setTimeout(resolve, 1000)); // Wait for 1 second\n  }\n  console.log('Job complete');\n}\n\nawait waitForPrintCompletion(printJob);\n```\n\n### `getPrinters() =\u003e Promise\u003cPrinter[]\u003e`\n\n**Returns**\n\n`Promise\u003cPrinter[]\u003e`: List of available printers.\n\n**Examples**\n\n```javascript\nimport { getPrinters } from \"unix-print\";\n\ngetPrinters().then(console.log);\n```\n\n### `getDefaultPrinter() =\u003e Promise\u003cPrinter | null\u003e`\n\n**Returns**\n\n`Promise\u003cPrinter | null\u003e`: System default printer or `null`.\n\n**Examples**\n\n```javascript\nimport { getPrinters } from \"unix-print\";\n\ngetDefaultPrinter().then(console.log);\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartiebits%2Funix-print","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartiebits%2Funix-print","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartiebits%2Funix-print/lists"}