环境: nodejs - v6.2.0
1 const fs = require('fs'); 2 3 let Promise = require('bluebird'); 4 5 let readSync = function(filePath) { 6 return new Promise(function(resolve, reject) { 7 fs.unlink(filePath, (err) => { 8 if(err) return reject(err); 9 return resolve(); 10 }) 11 }) 12 } 13 14 readSync('log').then(function(data) { 15 console.log('OKKKKK'); 16 }).catch(function(err) { 17 console.log(err || 'errror!!'); 18 })