Shell

88481456 2020-06-18

request的promise化

var Promise = require('bluebird')

var request = Promise.promisify(request)

var wechat = new 

 stringify。

 promisifyAll

--

const Promise = require('bluebird'),

  fs = require('fs'),

  path = require('path');

Promise.promisifyAll(fs);

fs.readFileAsync(path.join(__dirname, 'sample.txt'), 'utf-8')

  .then(data => console.log(data))

  .catch(err => console.error(err));

--

相关推荐