diff --git a/README.md b/README.md index 956174e..cb24b25 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,32 @@ Close all the listeners and muxers. - `callback` +### This module uses `pull-streams` + +We expose a streaming interface based on `pull-streams`, rather then on the Node.js core streams implementation (aka Node.js streams). `pull-streams` offers us a better mechanism for error handling and flow control guarantees. If you would like to know more about why we did this, see the discussion at this [issue](https://github.com/ipfs/js-ipfs/issues/362). + +You can learn more about pull-streams at: + +- [The history of Node.js streams, nodebp April 2014](https://www.youtube.com/watch?v=g5ewQEuXjsQ) +- [The history of streams, 2016](http://dominictarr.com/post/145135293917/history-of-streams) +- [pull-streams, the simple streaming primitive](http://dominictarr.com/post/149248845122/pull-streams-pull-streams-are-a-very-simple) +- [pull-streams documentation](https://pull-stream.github.io/) + +#### Converting `pull-streams` to Node.js Streams + +If you are a Node.js streams user, you can convert a pull-stream to a Node.js stream using the module [`pull-stream-to-stream`](https://github.com/dominictarr/pull-stream-to-stream), giving you an instance of a Node.js stream that is linked to the pull-stream. For example: + +```js +const pullToStream = require('pull-stream-to-stream') + +const nodeStreamInstance = pullToStream(pullStreamInstance) +// nodeStreamInstance is an instance of a Node.js Stream +``` + +To learn more about this utility, visit https://pull-stream.github.io/#pull-stream-to-stream. + + + ## Design ### Multitransport diff --git a/package.json b/package.json index b69b95b..5cf533d 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "libp2p-secio": "^0.4.2", "libp2p-spdy": "^0.9.0", "libp2p-tcp": "^0.8.1", - "libp2p-webrtc-star": "^0.4.1", + "libp2p-webrtc-star": "^0.4.4", "libp2p-websockets": "^0.8.1", "pre-commit": "^1.1.3", "pull-goodbye": "0.0.1", diff --git a/src/dial.js b/src/dial.js index f9ca8eb..004d01a 100644 --- a/src/dial.js +++ b/src/dial.js @@ -106,7 +106,6 @@ module.exports = function dial (swarm) { } const id = swarm._peerInfo.id - log('selecting crypto: %s', swarm.crypto.tag) ms.select(swarm.crypto.tag, (err, conn) => { if (err) {