🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

cups-printer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cups-printer

A package to print documents using CUPS Printer Server in Linux

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

CUPS Printer

A package to print documents using CUPS Printer Server in Linux. It's an ESM package written in typescript, using ava as testing library.

Installation

In your project, just type:

npm i --save cups-printer

How to use

Fow now, this package only gets printers and use these devices to print documents.

import { Printer } from 'cups-printer';
import { readFile } from 'fs/promises';

// Getting all printers installed in CUPS.
const all = await Printer.all();

// Finding directly a particular printer using a delegate.
const obj = await Printer.find(x => x.name.startsWith('EPSON'));

// Printing a PDF file...
await obj.print('document.pdf');

// ...or printing a buffer.
const byte = await readFile('document.pdf');
await obj.print(byte);

Typescript configuration

This package is an ECMAScript module, so the recommended configuration is settled using this in mind. Remember put in your package.json:

{
    "type": "module"
}

The tsconfig.json minimum recomended configuration is:

{
    "compilerOptions": {
        "target": "ES2022",
        "module": "ES2022",

        "outDir": "./dist",
        "rootDir": "./src",

        "strict": true,
        "moduleResolution": "node"
    }
}

Keywords

cups

FAQs

Package last updated on 23 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts