Skip to content

221B-io/unitverse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unitverse

Not on NPM yet, however...

npm -g lerna
git clone https://github.com/221B-io/unitverse
npm run bootstrap
npm run link
cd ..
mkdir test-unitverse && cd test-unitverse
npm init
npm link @unitverse/core @unitverse/collections @unitverse/crypto
touch index.js

Copy and paste some of the code below into index.js and run

node index.js

Getting Started

const Engine = require('unitverse');
const engine = new Engine();

engine.register('[email protected]', require('@unitverse/collections/queue'));
engine.register('[email protected]', require('@unitverse/crypto/hash'));

engine.run('queue', {
  tasks: [{
    'hash': {
      path: 'touch.txt',
      function: 'md5',
    },
  },],
  log: false,
}).then((result) => {
  console.log('result', result);
}).catch((error) => {
  console.log(error);
});

The run function

The run function can take a callback or return a promise, depending on whether or not callback is a function. For example, using the callback notation:

engine.run('hash', {
  path: 'touch.txt',
  function: 'md5',
}, (err, result,) => {
  console.log('result', result);
})

and Promise notation:

engine.run('hash', {
  path: 'touch.txt',
  function: 'md5',
}).then((result) => {
  console.log('promise', result);
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published