97 points · by sundip · 10y ago · 29 comments
* [promise-tools](https://github.com/benbria/node-promise-tools) is a library with a lot of the cool flow control from Bluebird, but is tiny and works with native Promises.
* [promise-breaker](https://github.com/jwalton/node-promise-breaker) is a library I wrote which is intended to make it really easy for third party libraries to support both promises and callbacks with a minimum of fuss (we also use this extensively internally as we convert our giant code base from callbacks to promises.) `callFn` and `applyFn` are also very handy for calling into existing callback based libraries from within promise based libraries.
EDIT: to answer my own question, this looks like it'll do it:
https://github.com/pgaubatz/node-es6-promisify-all
but it doesn't seem to be actively maintained.
See this specific blog post for more details (though the Rx Book is fantastic): "That said, a sore point for Promises has always been their lack of cancelability. This leads to some interesting design patterns where you have to "protect" your promise callbacks from context-dependent changes. Because of this hoop-jumping, the most attractive RxJS feature that I've seen so far is the simple ability to cancel (aka, unsubscribe, aka, dispose) an RxJS stream before it completes."
http://www.bennadel.com/blog/3030-canceling-rxjs-observables... (Though there are RxJS interops with more than just Angular)
[extends-promise](https://github.com/kjvalencik/extends-promise)
Fair warning, it has an emphasis on simplicity of code rather than speed. It does a few things that are very likely inefficient. I wrote it primarily to scratch an itch I had--embedding in one-off node.js scripts without any dependencies.
return Promise.map(arrayOfUrlsToDownload,downloadAndParseFunction,{concurrency:1})
One line for all your basic scraping/parsing needs.
Bluebird provides a lot of really useful methods and abstractions over promises that we use on a daily basis. Basically all the methods I point out in the article are not part of the Promise spec (and probably won't be). The other thing that Bluebird helps a lot with is providing functionality around transitioning from non-promise code to promises by providing methods such as `promisify`, `promisifyAll`, `fromCallback`, and `asCallback`.
http://programmers.stackexchange.com/questions/278778/why-ar...
1) Bluebird is orders of magnitude faster and more memory-efficient than the current V8 native promises. Better native promises performance has been promised, but we are still waiting for it.
2) Bluebird is just as much standard-compliant as are the native promises.
3) Bluebird has very useful extensions, which are not (yet?) part of the standard. You are not forced to use them, but they are still very nice to have.
The before code should not have Promise: "const fs = Promise.promisifyAll(require('fs'))"
import fs from 'fs';
Promise.promisifyAll(fs);
works great.In liveScript
do
error,output <- fs.readFile "helloWorld.txt"
console.log output.toString() # => "hello world from txt file"
you can combine that with co-routines to create really powerful abstractions, without the massive memory footprint of promises.i.e. use a different language because callbacks in javascript suck ? I prefer promises thank you. And promises ARE monads. No need for liveScript.