Tags "bluebird" Result

Convert promise to bluebird

I found an existing library that uses promises, however it doesn't use bluebird. The library functions don't come with all the extra features bluebird does like .map() or .tap(). How do I convert a "normal" or "non-bluebird" promise to a bluebird one, with all the extra features bluebird offers? I tried wrapping the existing promise in Promise.pro

it1352 2 2019-05-22

Returning a promised wrapped express route to app.use()

I'm looking to make an express route more modular. I was interested in using a promise to read a file then return the route. Here's the code: var express = require('express') var router = express.Router() var app = express() var Promise = require("bluebird") var fs = Promise.promisifyAll(require("fs")) function promiseRoute(file){ return fs.r

it1352 2 2020-09-21

How to use Bluebird with current TypeScript?

I just don't get it. Once this was relatively easy, I downloaded the snippet from DefinitelyTyped, it assumed it was globally declared, I added the script and it worked. Now it seems that I have no other option that to use a complex package manager and asynchronous loading system, possibly with an optimizer for production. Ideally I just want some

it1352 0 2020-08-24

How can I sequentially chain promises using bluebirdjs?

Promise.all() doesn't guarantee that promises will be resolved in order. How can this be done? Solution Since you're using Bluebird JS, this can be actually done in a simple way. In version 2.0, Bluebird introduced the Promise.each method that does this, for looping a then is simple enough, but since it is so common and got requested time after t

it1352 0 2019-05-22