var fs = require('fs'); var a = new Promise(function(resolve, reject) { fs.readFile('./1.txt', 'utf-8', function(err, data) { if (err) { return reject(err); } resolve(data); }); }); var b = new Promise(function(resolve, reject) { fs.readFile('./2.txt', 'utf-8', function(err, data) { if (err) { return reject(err); } resolve(data); }); }); a.then(function(res1) { console.log('res1'); console.log(res1); b.then(function(res2) { console.log('res1 + res2'); console.log(res1 + res2); }); }); // b.then(function(result){ // console.log(result); // }); fs.readFile('./1.txt', 'utf-8', function(err, data1) { if (err) { return reject(err); } else { console.log('data1'); console.log(data1); fs.readFile('./2.txt', 'utf-8', function(err, data2) { if (err) { return reject(err); } else { console.log('data1 + data2'); console.log(data1 + data2); } }); } });