file-pager
Pipe to $PAGER by creating a temporary file first
Last updated 5 years ago by eush77 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install file-pager 
SYNC missed versions from official npm registry.

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.

Related

Install

npm install file-pager

License

MIT

Current Tags

  • 0.1.0                                ...           latest (5 years ago)

1 Versions

  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 3
Dependencies (3)
Dev Dependencies (3)
Dependents (2)

Copyright 2014 - 2017 © taobao.org |