Giter Site home page Giter Site logo

async-stream's Introduction

Hi, I'm Julian ๐Ÿ‘‹

I'm a software engineer with a focus on P2P, Node.js, React, Blockchain and Electron.

Currently I'm creating Filecoin Station (desktop app) and Meridian (decentralized impact evaluator) at Protocol Labs.

async-stream's People

Contributors

greenkeeper[bot] avatar juliangruber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

esrefdurna

async-stream's Issues

readme clarification

Could totally be misunderstanding but what you mean by this (specifically the bolded part)?

A generator stream is simply a generator function. If you're familiar with other stream semantics: There's only readable streams, no need for writable and transform.

add co-queue example

for working with pushing sources.

function wrap(emitter, event){
  var queue = new Queue;
  emitter.on(event, queue.push);
  return function*(end){
    if (!end) return yield queue.next;
  };
}

var read = wrap(emitter, 'data');
while (true) console.log(yield read());

add pull-cat example

suggested by @dominictarr, https://github.com/dominictarr/pull-cat

function cat(streams){
  var idx = 0;
  return function*(end){
    if (end) return streams[idx](end);
    var data;
    while (!data && streams[idx]) {
      try {
        // read
        data = yield streams[idx]();
      } catch (err) {
        // clean up
        streams.slice(idx).forEach(function(stream){
          try { yield stream(true) } catch (_) {}
        });
      }
      if (!data) idx++;
    }
    return data;
  };
}

async

@Raynos can you please explain what kind of async streaming is missing?

function(){
  return function*(){
    return yield fs.readFile(nextLog)
  }
}

abort

@Raynos can you explain what you mean by "missing abort"?

We have ending streams by calling yield fn(true)l

add benchmarks

excellent idea by @dominictarr.

compare with:

  • node core stream 2
  • node core stream 1
  • pull stream
  • pull stream without libs
  • minstream
  • minstream without libs
  • reducers

what about when you *need* a parallel operation

say, a merge stream,
that takes N sorted streams and merges them into one stream?
(it would pull from each stream, but output chunks in correct order -
for example, to do a merge sort, or LSMT compaction)

A simpler one would just to merge multiple streams into one, but not control the order.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.