New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

thread-func

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thread-func

A simple library to run functions in a separate thread.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Thread Func

Description

This is a TypeScript library that provides a simple way to run functions in separate threads.

Installation

You can install this library using npm:

npm install thread-func

Usage

import { threadFunc } from 'thread-func';

export const method = threadFunc(async (input: number) => {
    // Some code
    return input * 42;
});

Signature

threadFunc<T, R>(func: (input: T) => Promise<R>, options): (input: T) => Promise<R>;

Options

{
    maxThreads: number = Infinity; // Maximum number of threads to run in parallel.
    variant: 'child_process' | 'worker_threads' = 'worker_threads'; // The type of thread to use.
}

License

This library is licensed under the MIT license.

FAQs

Package last updated on 17 Dec 2023

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