process-exists
    TypeScript icon, indicating that this package has built-in type declarations

    4.1.0 • Public • Published

    process-exists

    Check if a process is running

    Install

    $ npm install process-exists
    

    Usage

    const processExists = require('process-exists');
    
    (async () => {
    	console.log(await processExists(process.pid));
    	//=> true
    
    	const exists = await processExists.all([process.pid, 'foo']);
    
    	console.log(exists.get(process.pid));
    	//=> true
    
    	console.log(exists.get('foo'));
    	//=> false
    
    	console.log(processExists.filterExists(exists));
    	//=> [process.pid]
    })();

    API

    processExists(input)

    Returns a Promise<boolean>.

    input

    Type: number | string

    Process ID or name to check.

    processExists.all(input)

    Returns a Promise<Map> with the process name/ID as key and the status as a boolean value.

    input

    Type: Array<number | string>

    Process IDs or names to check.

    processExists.filterExists(input)

    Returns an Array<number | string> with the processes that exist.

    input

    Type: Array<number | string>

    Process IDs or names to check.

    Install

    npm i process-exists

    DownloadsWeekly Downloads

    149,617

    Version

    4.1.0

    License

    MIT

    Unpacked Size

    4.67 kB

    Total Files

    5

    Last publish

    Collaborators

    • sindresorhus