UNPKG

1.47 kBMarkdownView Raw
1# bin-v8-flags-filter
2[![Build Status](https://api.travis-ci.org/inikulin/bin-v8-flags-filter.svg)](https://travis-ci.org/inikulin/bin-v8-flags-filter)
3
4*Filters out v8 flags for your Node.js CLIs.*
5
6Filters out well-known v8 flags given to your app and spawns new process with v8 flags passed to Node.js and the rest
7of the args passed to your actual CLI. Basically an extraction of related [mocha code](https://github.com/mochajs/mocha/blob/master/bin/mocha).
8
9## Install
10```
11npm install bin-v8-flags-filter
12```
13
14## Usage
15*In JS file specified as `bin` in your `package.json`:*
16```js
17const v8FlagsFilter = require('bin-v8-flags-filter');
18const path = require('path');
19
20const cliPath = path.join(__dirname, './cli.js'); // Path to your actual CLI file that contains app code.
21
22v8FlagsFilter(cliPath);
23```
24
25### API
26#### `v8FlagsFilter(path, [options])`
27 - `path` - path to CLI script.
28 - `options` - an optional object with the following optional keys:
29 - `ignore` - an array of v8 flags to ignore, i.e. to _not_ filter-out when spawning a new process.
30 - `forcedKillDelay` - a number of milliseconds after which to send a kill command to the spawned process, only after an interrupt has already been issued. Defaults to `30000`.
31 - `useShutdownMessage` - rather than forwarding along interrupt signals to the spawned process, instead forwards a `'shutdown'` message to the spawned process.
32
33## Author
34[Ivan Nikulin](https://github.com/inikulin) (ifaaan@gmail.com)