Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

file-pager

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-pager

Pipe to $PAGER by creating a temporary file first

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

npm

file-pager

Build Status Dependency Status

Pipe to $PAGER by creating a temporary file first.

Why

Some pagers can determine the proper highlighting mode from file extension. Your favorite pager probably can.

Usage

var pager = require('file-pager');
var fs = require('fs');

fs.createReadStream(require.resolve('file-pager'))
  .pipe(pager({ ext: 'js' }, function () {
    console.log('Done.');
  }));

npm run example to open source file for this module with syntax highlighting (if your pager supports it and is configured correctly).

API

pager = require('file-pager')

pager(opts, [done(err)])

Returns a writable stream.

done(err)

Callback invoked when pager is terminated.

opts can specify temporary file name with different levels of granularity.

opts.path

Path to file. This is the only case in which file won't be removed after pager is closed.

stream.pipe(pager({ path: '/file' })) is effectively tee /file | $PAGER.

opts.basename

Base name (last component) to create temporary file with.

opts.ext

File extension to create temporary file with.

  • default-pager if you don't need temporary file mediator.

Install

npm install file-pager

License

MIT

Keywords

text

FAQs

Package last updated on 15 Aug 2015

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