Skip to content

jwerle/worker-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

worker-stream

Stream interface for web workers

install

Install with component(1):

$ component install jwerle/worker-stream

usage

main.js

var node = document.getElementById('node');
var WorkerStream = require('worker-stream');
var wstream = WorkerStream('worker.js');

wstream.on('data', function (chunk) {
  console.log(chunk)
});

wstream.write('biz')

worker.js

// import somefile to provide `WorkerStream'
importScripts(
  'path/to/worker-stream/build.js'
);

var WorkerStream = require('worker-stream');
var stream = WorkerStream(self);

stream.on('data', function (chunk) {
  console.log('worker: '+  chunk)
});

stream.write('foo');

api

WorkerStream(worker [, opts])

  • worker - A string path to a worker or an instance of a Worker
  • opts - Stream options (optional)

License

MIT

About

Stream interface for web workers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published