0.1.0 • Published 11 years ago

sak-forkarguments v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
11 years ago

Sak-fork-arguments

Build Status Dependency Status Coverage Status

Version 0.1.0

Encode a value to be passed in forking a process and then decoded and used.

Created by Thomas de Zeeuw, thomasdezeeuw@gmail.com (https://thomasdezeeuw.nl/).

Released under a MIT license.

Exports

encode

Function

Encode arguments to pass when forking a process.

Example

// Master process
var options = {port: 8000, env: 'production'}
  , encoded = encode(options)
  , child = cp.fork('./my-child-script.js', encoded);

Params

NameDescriptionType
dataThe data to pass to the forked process.

Return

DescriptionType
An array with encoded data, ready to be passed to the forking function.Array

decode

Function

Decode arguments that are passed to a forked process.

Example

// Child process
var options = decode(process.argv.slice(2));
console.log('options', options); // options {port: 8000, env: 'production'}

Params

NameDescriptionType
argsThe array from process.argv.slice(2), dropping the path to node bin and the file.Array

Return

DescriptionType
The date passed to the forked process.Object
0.1.0

11 years ago