Code Monkey home page Code Monkey logo

Comments (3)

dmvaldman avatar dmvaldman commented on May 18, 2024

Hi Adrian, nice to hear from you again!

I can see where you're coming from. I'm kind of reinventing the wheel here, but there are good reasons for it. I may consider making the API compatible with Node in the future. Currently, EventEmitter has the same API as Node's. The reason streams are different is several-fold. One, there's no need for read and write streams as we're not doing filesystem stuff. The UI focus also needs me to have a start event in addition to Node's data (update) and end events. I've also gone for subscribe over pipe, which is a difference of "pull" versus "push" and has some performance advantages. For one, there's no need for backpressure logic. But I may support pipe in the future as there are use cases for it. It would definitely be a huge win to be able to piggy-back off the node ecosystem.

Do you know of data-agnostic libraries that use Node streams? I haven't done much research here.

from samsara.

AdrianRossouw avatar AdrianRossouw commented on May 18, 2024

Well. for each point.

  1. node streams are specialised event emitters, so i'd recommend starting out by just using the event emitter as a base to begin with.
  2. the read/write distinction is a valid concern, but the majority of streams you deal with end up being Transform/through streams or Duplex streams. Which can both be read and written from.
  3. While not called start, there is a 'readable' event which gets fired when a stream starts.
  4. Custom stream implementations are completely free to add additional events to emit.
  5. Node streams can be both push or pull streams.

Well, I guess it depends on what you mean by "data agnostic". All node streams don't particularly care about what you are streaming through them. The biggest distinction is whether they are running in binary/text, or in objectMode.

You should probably check out highlandjs, which is by the guy who wrote the async.js library. My favorite part of it is that you can use promises, callbacks and generators directly. It is not exactly compatible with node streams tho.

If you wanna chat about this stuff sometime, i'd be open to it. My interest in famous came about because I was looking to use it in a stream-oriented architecture as part of my graft project, so i've done a lot of research on the subject.

from samsara.

dmvaldman avatar dmvaldman commented on May 18, 2024

As this is not an issue with the code itself, I'd prefer it be raised in the google group: groups.google.com/forum/#!forum/samsarajs

Feel free to repost there!

from samsara.

Related Issues (20)

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.