Gathering detailed insights and metrics for cross-spawn-extra
Gathering detailed insights and metrics for cross-spawn-extra
npm install cross-spawn-extra
Typescript
Module System
Node Version
NPM Version
TypeScript (89.98%)
JavaScript (10.02%)
Total Downloads
135,150
Last Day
61
Last Week
678
Last Month
6,224
Last Year
61,661
25 Commits
3 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
3.0.3
Package Id
cross-spawn-extra@3.0.3
Unpacked Size
123.79 kB
Size
17.44 kB
File Count
18
NPM Version
10.5.0
Node Version
21.7.1
Publised On
09 Mar 2024
Cumulative downloads
Total Downloads
Last day
-17.6%
61
Compared to previous day
Last week
-43.3%
678
Compared to previous week
Last month
-36.3%
6,224
Compared to previous month
Last year
121.8%
61,661
Compared to previous year
a async version for cross-spawn and make it return like as sync return
npm install cross-spawn-extra cross-spawn
1export interface SpawnOptions 2{ 3 cwd?: string; 4 env?: any; 5 stdio?: 'inherit' | 'ignore' | 'pipe' | any | Array<'inherit' | 'ignore' | 'pipe' | any>; 6 detached?: boolean; 7 uid?: number; 8 gid?: number; 9 shell?: boolean | string; 10 windowsVerbatimArguments?: boolean; 11 windowsHide?: boolean; 12 13 /** 14 * Strip ANSI escape codes 15 */ 16 stripAnsi?: boolean, 17} 18 19export interface SpawnSyncOptions { 20 cwd?: string; 21 input?: string | Buffer; 22 stdio?: 'inherit' | 'ignore' | 'pipe' | any | Array<'inherit' | 'ignore' | 'pipe' | any>; 23 env?: any; 24 uid?: number; 25 gid?: number; 26 timeout?: number; 27 killSignal?: string; 28 maxBuffer?: number; 29 encoding?: string; 30 shell?: boolean | string; 31 windowsHide?: boolean; 32 windowsVerbatimArguments?: boolean; 33 34 /** 35 * Strip ANSI escape codes 36 */ 37 stripAnsi?: boolean, 38}
1import crossSpawn = require('cross-spawn-extra'); 2import crossSpawn from 'cross-spawn-extra'; 3import { async as crossSpawnAsync, sync as crossSpawnSync } from 'cross-spawn-extra';
1import { CrossSpawn } = require('cross-spawn-extra/core'); 2import CrossSpawn from 'cross-spawn-extra'; 3import { CrossSpawn } from 'cross-spawn-extra'; 4 5//---------- 6 7const crossSpawn = new CrossSpawn(require('cross-spawn')); 8const crossSpawn = CrossSpawn.use(require('cross-spawn'));
1let bin = './bin/log0001'; 2 3let cp = crossSpawn('node', [ 4 bin, 5], { 6 cwd: __dirname, 7 8 /** 9 * Strip ANSI escape codes 10 */ 11 stripAnsi: true, 12}) 13 .then(function (child) 14 { 15 return log(child); 16 }) 17 .catch(function (err) 18 { 19 let child = err.child; 20 21 return log(child); 22 }) 23; 24 25function log(child: SpawnASyncReturns) 26{ 27 let { stdout, stderr, output, _output, status, signal, pid } = child; 28 29 // can still via stream, but it already close 30 let { stderrStream, stdoutStream } = child; 31 32 console.log({ 33 pid, 34 error: !!child.error, 35 status, 36 stdout: stdout.toString(), 37 stderr: stderr.toString(), 38 _output: Buffer.concat(_output).toString(), 39 }); 40 41 return child; 42}
if typescript fail when use
crossSpawn
, try usecrossSpawn.async
1let bin = './bin/log0001'; 2 3let cp = crossSpawn.async('node', [ 4 bin, 5], { 6 cwd: __dirname, 7}) 8 .then(function (child) 9 { 10 return log(child); 11 }) 12 .catch(function (err) 13 { 14 let child = err.child; 15 16 return log(child); 17 }) 18;
stdout
only show stdout
stderr
only show stderr
but _output
can show real output order
1{ pid: 54268, 2 error: false, 3 status: 0, 4 stdout: 'log 0\nlog 2\nlog 4\ndebug 5\nlog 6\ninfo 7\nlog 8\n', 5 stderr: 'error 1\nwarn 3\n', 6 _output: 7 'log 0\nerror 1\nlog 2\nwarn 3\nlog 4\ndebug 5\nlog 6\ninfo 7\nlog 8\n' }
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/25 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-12-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More