0.3.2 • Published 5 years ago

@mhio/jobs v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Jobs

Manage a process as a Job.

Execute a Job, recieve an ID

Query the start of the Job.

Install

yarn add @mhio/job
npm install @mhio/job

Usage

API Docs

import { Job } from '@mhio/job'

let job = new Job({ command: [ 'printf', '%s\n%s\n', 'one', 'two' ] })
try {
  console.log('Job ID %s', job.id)
  await job.run() // resolves to the same `job` instance
  console.log(job.output)
} catch (err) {
  console.error(err)
  console.error('Job output', job.output)
}
import { Jobs } from '@mhio/job'

let jobs = new Jobs()
let job = jobs.createJob({ command: [ 'sh', '-c', 'echo running; sleep 4; exit 2' ] })
job.run().catch(err => console.error(err)  // resolves to the same `job` instance
console.log('Job "%s" running in the background', job.id)
0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.2.0-1

5 years ago

0.1.1

7 years ago

0.1.0

7 years ago