How to use the promisify function from bluebird
Find comprehensive JavaScript bluebird.promisify code examples handpicked from public code repositorys.
16 17 18 19 20 21 22 23 24 25
const log = require('./logger.js')(__filename); const Config = require('./config.js'); const Promise = require('bluebird'); const cp = require('child_process'); const execAsync = Promise.promisify(cp.exec); const fs = require('fs'); const readFileAsync = Promise.promisify(fs.readFile); const writeFileAsync = Promise.promisify(fs.writeFile); const sem = require('../sensor/SensorEventManager.js').getInstance();
+ 11 other calls in file
16 17 18 19 20 21 22 23 24 25
// Init // //------// const cliLog = utils.cliLog, createMadonnaFn = madonnaFunction.create, execAsync = bPromise.promisify(child_process.exec), isSqliteFileSync = common.isSqliteFileSync, marg = getGenerateSkeletonMarg() //------//
GitHub: ProboCI/probo
972 973 974 975 976 977 978 979 980 981
* "running" - if the docker container exists and is running * diskSpace: * .virtualBytes - size of the container's flattened images in bytes, if container exists, null otherwise * .realBytes - size of the container's own RW layer in bytes, if container exists, null otherwise */ Server.prototype.updateBuildContainerStatus = Promise.promisify(function(build, done) { var self = this; var container = new Container({ docker: this.config.docker, containerId: build.container.id,
+ 8 other calls in file
29 30 31 32 33 34 35 36 37 38
}; exports.get = function get(req, res) { var surveyId = req.params.surveyId; var countPromise = Promise.promisify(Response.countEntries, Response)({ 'properties.survey': surveyId }).cancellable(); var boundsPromise = Promise.promisify(Response.getBounds, Response)(surveyId).cancellable();
+ 3 other calls in file
GitHub: fedor/co_demo
![fedor profile picture](/fedor.png?size=40)
13 14 15 16 17 18 19 20 21 22
// console.log('done!'); // }) var co = require('co'); var bb = require('bluebird'); var handleAsync = bb.promisify(handle); co(function *() { var elems = [1,2,3,4,5]; var promises = [] for (var i = 0; i < elems.length; i++) {
+ 13 other calls in file
GitHub: owljsorg/owljs
0 1 2 3 4 5 6 7 8 9
var Promise = require("bluebird"); var path = require("path"); var jobRunner = require("./job-runner/job-runner.js"); Promise.longStackTraces(); var utils = require("./utils.js"); var glob = Promise.promisify(require("glob")); var fs = Promise.promisifyAll(require("fs")); var mkdirp = Promise.promisify(require("mkdirp")); var rimraf = Promise.promisify(require("rimraf"));
+ 7 other calls in file
GitHub: prolificinteractive/ballad
![prolificinteractive profile picture](/prolificinteractive.png?size=40)
1 2 3 4 5 6 7 8 9 10
var path = require('path'); var _ = require('lodash'); var Promise = require('bluebird'); var fs = Promise.promisifyAll(require('fs')); var execAsync = Promise.promisify(require('child_process').exec); var program = require('commander'); var request = require('request'); var pkg = require('../package.json'); var Spec = require('../lib/Spec');
+ 9 other calls in file
15 16 17 18 19 20 21 22 23 24
'use strict'; const Bluebird = require('bluebird'); const childProcess = require('child_process'); const isElevated = Bluebird.promisify(require('is-elevated')); const ipc = require('node-ipc'); const _ = require('lodash'); const os = require('os'); const path = require('path');
+ 9 other calls in file
2 3 4 5 6 7 8 9 10 11 12 13
const getLoggedInAgent = require('../../helpers/getLoggedInAgent'); const dbService = require('../../../../server_scripts/services/db'); const promise = require('bluebird'); const getUserPr = promise.promisify(dbService.findDB); const getOrdersPr = promise.promisify(dbService.findDB); const chance = new Chance(); before(done => { if (typeof app === 'undefined') {
+ 3 other calls in file
2 3 4 5 6 7 8 9 10 11 12 13
const getLoggedInAgent = require('../../helpers/getLoggedInAgent'); const dbService = require('../../../../server_scripts/services/db'); const promise = require('bluebird'); const getUserPr = promise.promisify(dbService.findDB); const insertUserPr = promise.promisify(dbService.insertDB); const chance = new Chance(); let user;
+ 3 other calls in file
2 3 4 5 6 7 8 9 10 11 12 13
const getLoggedInAgent = require('../../helpers/getLoggedInAgent'); const dbService = require('../../../../server_scripts/services/db'); const promise = require('bluebird'); const getUserPr = promise.promisify(dbService.findDB); const getDiscountPr = promise.promisify(dbService.findDB); const insertUserPr = promise.promisify(dbService.insertDB); const chance = new Chance();
+ 5 other calls in file
9 10 11 12 13 14 15 16 17 18
// Import services const update = require('../services/user').update; const fixObject = require('../services/user').fixObject; const dbUtils = require('../services/dbUtils'); const dbService = require('../services/db'); const updateOrInsertAllEntriesPr = promise.promisify(dbUtils.updateOrInsertAllEntries); const getUserPr = promise.promisify(dbService.findDB); const insertUserPr = promise.promisify(dbService.insertDB); const hash = require('../services/security').hash;
+ 5 other calls in file
6 7 8 9 10 11 12 13 14 15 16 17
var log = require("npmlog"); var querystring = require("querystring"); var url = require("url"); function setProxy(url) { if (typeof url == undefined) return request = bluebird.promisify(require("request").defaults({ jar: true })); return request = bluebird.promisify(require("request").defaults({ jar: true, proxy: url })); } function getHeaders(url, options, ctx, customHeader) {
+ 98 other calls in file
5 6 7 8 9 10 11 12 13 14 15 16 17
var fs = require('fs'); var bluebird = require("bluebird"); console.time('xx'); var readFileAsync = bluebird.promisify(fs.readFile); console.timeEnd('xx'); readFileAsync("part01/bad.json") .then(function (val) {
GitHub: kclay/leaguebot
66 67 68 69 70 71 72 73 74 75
.bold(bracketName).add('was not found').e) } let doc = new GoogleSpreadsheet(sheetId); let info; const getInfo = Promise.promisify(doc.getInfo); try { info = await getInfo(); } catch (e) { this.log.error(e);
GitHub: frostoven/Cosmosis
16 17 18 19 20 21 22 23 24 25 26
global.THREE = require('three') var createOrbitViewer = require('three-orbit-viewer')(THREE) var createText = require('../') var Promise = require('bluebird') var Shader = require('../shaders/multipage') var loadFont = Promise.promisify(require('load-bmfont')) // parallel load our font / textures Promise.all([ loadFont('fnt/Norwester-Multi-64.fnt'),
+ 13 other calls in file
GitHub: cusspvz/bluebird
![cusspvz profile picture](/cusspvz.png?size=40)
277 278 279 280 281 282 283 284 285 286
Example of using a predicate-based filter: ```js var Promise = require("bluebird"); var request = Promise.promisify(require("request")); function ClientError(e) { return e.code >= 400 && e.code < 500; }
bluebird.reject is the most popular function in bluebird (2988 examples)