npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-printer-turbo

v1.0.1

Published

Create and manage one or multiple printers (w/ CUPS), send file path or node buffer with support for all lp options. Get feedback on jobs you sent.

Downloads

9

Readme

node-printer

Code Climate

:warning: This package must only be used for prototyping

:rotating_light: I said this package is not reliable! And MUST NOT be used in production

It relies on a CUPS STDOUT text parser and has not been tested for all version of CUPS! If you are looking for a way to manage and send data to printers take a look at alepee/node-ipp-interface which relies on IPP protocol and provide a more constistent way to communicate with a printer. (node-ipp-interface module is a WIP, please feel free to contribute)

Please note that the way I wrote this library as a prototype. It relies on STDOUT from CUPS binaries and is not trustable.

The correct way to manage printers and jobs would be to use IPP protocol defined by RFCs. You can have a look at alepee/node-ipp-interface, it is based on it but still isn't finished yet. I can give you some help if needed to complete it.

Further reading about IPP

  • RFC 2567 – Design Goals for an Internet Printing Protocol
  • RFC 2568 – Rationale for the Structure and Model and Protocol for the Internet Printing Protocol
  • RFC 2569 – Mapping between LPD and IPP Protocols
  • RFC 2910 – Internet Printing Protocol/1.1: Encoding and Transport
  • RFC 2911 – Internet Printing Protocol/1.1: Model and Semantics

A tool to print document or data. Based on "lp" binary STDOUT.
Supports complete set of lp options (http://unixhelp.ed.ac.uk/CGI/man-cgi?lp)

Based on armetiz/node-printer-lp and diegoalberto/node-printer-lp-complete.

Quick Examples

var Printer = require('node-printer');
var options = {
    media: 'Custom.200x600mm',
    n: 3
};

// Get available printers list
Printer.list();

// Create a new Pinter from available devices
var printer = new Printer('EPSON_SX510');

// Print from a buffer, file path or text
var fileBuffer = fs.readFileSync('/path/to/file.ext');
var jobFromBuffer = printer.printBuffer(fileBuffer);

var filePath = 'package.json';
var jobFromFile = printer.printFile(filePath);

var text = 'Print text directly, when needed: e.g. barcode printers'
var jobFromText = printer.printText(text);

// Cancel a job
jobFromFile.cancel();

// Listen events from job
jobFromBuffer.once('sent', function() {
    jobFromBuffer.on('completed', function() {
        console.log('Job ' + jobFromBuffer.identifier + 'has been printed');
        jobFromBuffer.removeAllListeners();
    });
});

Roadmap

  • Rewrite option factories
  • Remove dependency to underscorejs
  • Write more tests
  • Find a way to emulate CUPS printers on Travis env