---
title: "Shell"
author: "yangbinfx"
date: "2020-06-18T17:58:23Z"
tags: []
categories: ["Web前端"]
slug: "shell"
draft: false
lastmod: "2020-06-18T21:17:06Z"
id: 2514981
url: "https://yangbinfx.iteye.com/blog/2514981"
---

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 =&gt; console.log(data))

 

  .catch(err =&gt; console.error(err));

--