upload
const fs = require('fs'); const glob = require('glob'); const request = require('request'); var config = require('../package.json'); const formData = {}; glob('build/**', {nodir: true}, function (err, files) { files.forEach((file) => { const fullPath = `/export/www/html/${config.ftpServer}${file.replace(/^build/, '')}`; formData[fullPath] = fs.createReadStream(file); }); request.post({ url: 'http://xxxxx:3000', formData: formData }, (err, res) => { if (err) { console.log(err); } console.log(`上传文件成功`); }) })