voodootikigod/node-serialport — pull request #431 by joshperry (2014-12-31 00:27:38+00:00)
Title: SerialPort Streams2 Implementation

These are my initial bullet points for what I'd like this PR to eventually consist of. This will change and, most likely, grow. I'm pushing this up early because I would absolutely love input/ideas on this. It's not quite ready to use yet, still working on tests and kind of hashing out plans on where and how to do things.

There are a couple issues that makes this lib mesh poorly with contemporary node.js code:
* There are 3 ways to handle errors (global emitter, instance emitter, callbacks).
* It implements most of the streaming logic itself which makes it much more complex than it need be.
* Functions and events for reading and writing are inconsistent with node Streams2

- [ ] Implement a Duplex Streams2 stream
- [ ] Make precondition errors more consistent
- [ ] Error events are always emitted whether there is a callback or not
- [ ] Remove callbacks from most functions and rely on stream events
- [ ] Goodbye global event emitter
- [ ] Goodbye opening port immediately from constructor, including callback parameter
- [ ] Add `openPort()` module export for simultaneously creating and opening a port, similar to the `net.createConnection` for `net.Socket`.
- [ ] Callback to `open()` is the same as `.once(‘open’, …)`
- [ ] Goodbye parsers, prefer transform streams