Skip to content

koolii/async-subtask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[WIP] async-subtask

This module offers interface which execs async function(and promise) in child_process which Node.js has already.

environment

Node.js(x < 8.3.9)

model-case

// example/example0.js
const fetch = require('node-fetch')
const fork = require('async-subtask')

const expression = async (url) => {
  const response = await fetch(url)
  const text = await response.json()
  return text
}

const main = async () => {
  const responseText = await fork({
    expression,
    argument: ['http://example.com/'],
    dependencies: ['node-fetch:fetch'],
  })

  console.log(responseText)
}

main()

About

exec async function into child_process using `child_process.fork()`

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published