npm

Need private packages and team management tools?Check out npm Orgs. »

crowdjs

0.2.0 • Public • Published

crowd

Crowd computing in Javascript. Distribute tasks to execute to other computers

Warning: This is a super pre-alpha software. It will only works if you are brave and patient. Watch/Star to follow with the progress

Project goal

Enable a computer to distribute tasks to execute to other computers. Websites can use computing power of visitors to test performance, scientists can distributedly fold DNA, hackers can distributedly crack passwords (:/).

Usage

Eventually one would be able to do something on these lines:

// Server
var Crowd = require('crowd')
var router = require('crowd-express')
 
function task (data) {
  // some calculations
  return result 
}
var crowd = new Crowd({x:1, y:2}, task)
  .on('data', function(data) {
    // data coming in real time
  })
  .on('end', function(results) {
    // task completed
  })
  .on('error', function(err) {
    // errors on the way
  })
 
var express = require('express')
var app = express()
var bodyParser = require('body-parser')
var port = process.env.PORT || 8080
app.use(bodyParser())
app.use('/task', router(crowd))
app.listen(port)
 

The way it will work on the client will be:

var worker = require('crowd-webworker')
var crowd = require('crowd-client')
var rest = require('crowd-rest')
 
crowd(opts)
  .use(rest('http://127.0.0.1:1200/task'))
  .pipe(worker())

What happens in the worker is that the task function is retrieved from the crowd-client, evaluated and executed.

State

Other usage

Obviously this is not bound to javascript, to REST and to the browser. Server and clients will be available for WebSockets and WebRTC, and you will be free to implement any of the technology you want.

install

npm i crowdjs

Downloadsweekly downloads

1

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability