repl.txt (2434B)
1 2 {{alias}}( files, [options,] clbk ) 3 Executes scripts in parallel. 4 5 Relative file paths are resolved relative to the current working directory. 6 7 Ordered script output does not imply that scripts are executed in order. To 8 preserve script order, execute the scripts sequentially via some other 9 means. 10 11 Parameters 12 ---------- 13 files: Array<string> 14 Script file paths. 15 16 options: Object (optional) 17 Options. 18 19 options.cmd: string (optional) 20 Executable file/command. Default: `'node'`. 21 22 options.concurrency: integer (optional) 23 Number of scripts to execute concurrently. Script concurrency cannot 24 exceed the number of scripts. By specifying a concurrency greater than 25 the number of workers, a worker may be executing more than `1` script at 26 any one time. While not likely to be advantageous for synchronous 27 scripts, setting a higher concurrency may be advantageous for scripts 28 performing asynchronous tasks. If the script concurrency is less than 29 the number of workers, the number of workers is reduced to match the 30 specified concurrency. Default: `options.workers`. 31 32 options.workers: integer (optional) 33 Number of workers. Default: number of CPUs minus `1`. 34 35 options.ordered: boolean (optional) 36 Boolean indicating whether to preserve the order of script output. By 37 default, the `stdio` output for each script is interleaved; i.e., the 38 `stdio` output from one script may be interleaved with the `stdio` 39 output from one or more other scripts. To preserve the `stdio` output 40 order for each script, set the `ordered` option to `true`. Default: 41 `false`. 42 43 options.uid: integer (optional) 44 Process user identity. 45 46 options.gid: integer (optional) 47 Process group identity. 48 49 options.maxBuffer: integer (optional) 50 Max child process `stdio` buffer size. This option is only applied when 51 `options.ordered = true`. Default: `200*1024*1024`. 52 53 clbk: Function 54 Callback to invoke after executing all scripts. 55 56 Examples 57 -------- 58 > function done( error ) { if ( error ) { throw error; } }; 59 > var files = [ './a.js', './b.js' ]; 60 > {{alias}}( files, done ); 61 62 // Specify the number of workers: 63 > var opts = { 'workers': 8 }; 64 > {{alias}}( files, opts, done ); 65 66 See Also 67 -------- 68