💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
## 正确使用 ``` const fs = require('fs') const path = require('path') function getFileByPath(fpath) { return promise = new Promise(function (resolve, reject) { fs.readFile(path.join(__dirname, fpath), 'utf-8', (err, data) => { if (err) return reject(err); resolve(data); }); }); } //读取文件1 getFileByPath('./1.txt') .then(function (data) { console.log(data); //读取文件2 //在上一个.then()中返回一个新的promise实例,可以继续用下一个.then()来处理 return getFileByPath('./2.txt'); }).then(function (data) { console.log(data); //读取文件3 return getFileByPath('./3.txt'); }).then(function (data) { console.log(data) }) ```