JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10280
  • Score
    100M100P100Q122313F
  • License MIT

A tiny wrapper for Node.js worker_threads lib

Package Exports

  • microjob

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (microjob) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Microjob

A tiny wrapper for turning Node.js threads in easy-to-use routines for high CPU-bound.

Requirements

Microjob can be used only with Node.js 10.5+ and with the --experimental-worker flag activated, otherwise it won't work.

Quick Example

const { job } = require('microjob')

(async () => {
  try {
    // this function will be executed in another thread
    const res = await job(() => {
      let i = 0
      for (i = 0; i < 1000000; i++) {}

      return i
    })

    console.log(res) // 1000000
  } catch (err) {
    console.error(err)
  }
})()

Documentation

Dive deep into the documentation to know more: https://wilk.github.io/microjob/