Socket
Book a DemoInstallSign in
Socket

node-forkit

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

node-forkit

Execute any function without blocking the main thread.

1.0.2
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Node forkit

Execute any function without blocking the main thread.

Installation

npm -i node-forkit

Usage

const forkIt = require('node-forkit');

const my_function = () => {
    // long function.
    let duration = 60
    let start = new Date().getTime()
    let expire = start + 1000 * duration;
    while (new Date().getTime() < expire) {}

    console.log(`Executed in a forked process and took {duration}s.`);
};

await forkIt(my_function);
    .catch(err => console.error(err));
// Executed in a forked process and took 60s.
const forkIt = require('node-forkit');

let data = await forkit(__dirname + '/path_to_file', {...arguments})
    .catch(err => console.error(err)); 
// 7

License

MIT

Keywords

NodeJs

FAQs

Package last updated on 19 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.