pouchdb-community / pouchdb-replication-stream

Replicate PouchDB/CouchDB databases with Node.js-style streams
Apache License 2.0
189 stars 58 forks source link

Use a real stream #1

Closed calvinmetcalf closed 10 years ago

calvinmetcalf commented 10 years ago

You will thank me later, you can use the noms module I just created

nolanlawson commented 10 years ago

PR? I really have no idea what I'm doing when it comes to streams. I couldn't even figure out how to write the unit tests without using fs.

calvinmetcalf commented 10 years ago

for testing, know what you can use? https://github.com/calvinmetcalf/random-document-stream

calvinmetcalf commented 10 years ago

so the way you tend to communicate with a stream is not object.method(stream); but usually more like object.method().pipe(stream) in other words to put data into a writable stream you return a readable stream you don't directly put it in.

nolanlawson commented 10 years ago

So what you mean by "real stream" is that the WritableStreamPouch inherits from the TransformStream? Also, what is the point of the through2 stream, anyway?

I suppose if what you're saying is true then I should also look into renaming the load and dump methods to just use stream methods like pipe and write. It looks like that would conflict with pouch-stream, though.

nolanlawson commented 10 years ago

http://nodejsreactions.tumblr.com/post/91958893106/when-i-try-to-use-streams