# file-pager

> Pipe to $PAGER by creating a temporary file first

Latest version **0.1.0** (published 2015-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install file-pager
pnpm add file-pager
yarn add file-pager
bun add file-pager
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-08-15 |
| First published | 2015-08-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Eugene Sharygin |
| Maintainers | eush77 |
| Keywords | text, pager, shell, less, more, file, temporary, tmp, filename, lessopen, extension, path, stream, pipe, create |

## Links

- npm: https://www.npmjs.com/package/file-pager
- Repository: https://github.com/eush77/file-pager
- Issues: https://github.com/eush77/file-pager/issues
- npm.io page: https://npm.io/package/file-pager

## Dependencies (3)

- [rimraf](https://npm.io/package/rimraf.md) ^2.4.2
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [gettemporaryfilepath](https://npm.io/package/gettemporaryfilepath.md) 0.0.1

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-08-15

## README

[![npm](https://nodei.co/npm/file-pager.png)](https://npmjs.com/package/file-pager)

# file-pager

[![Build Status][travis-badge]][travis] [![Dependency Status][david-badge]][david]

Pipe to `$PAGER` by creating a temporary file first.

[travis]: https://travis-ci.org/eush77/file-pager
[travis-badge]: https://travis-ci.org/eush77/file-pager.svg
[david]: https://david-dm.org/eush77/file-pager
[david-badge]: https://david-dm.org/eush77/file-pager.png

## Why

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

## Usage

```js
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

- [`default-pager`][default-pager] if you don't need temporary file mediator.

[default-pager]: https://npm.im/default-pager

## Install

```
npm install file-pager
```

## License

MIT

---
_Source: https://npm.io/package/file-pager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
