Closed rzp1 closed 5 years ago
//将文件上传到ftp目标地址 async function put(currentFile, targetFilePath) { const rs = fs.createReadStream(currentFile); const fileName = path.basename(targetFilePath); return new Promise((resolve, reject) => { client.put(rs, fileName, (err) => { resolve({ err: err }); client.end() }) }); } await readyFtp() await fs.writeFileSync('./config.json', JSON.stringify(ctx.request.body)) await put('config.json', 'config.json')
add setTimeout
put callback is not work