jerry2359 / ftp-upload Goto Github PK
View Code? Open in Web Editor NEW使用nodejs ftp模块上传多个文件
使用nodejs ftp模块上传多个文件
和你的例子一样,为什么不行呢
const FtpUpload = require('ftp-upload')
const ftpUpload = new FtpUpload({
// 指定一个远程域名,生成测试连接时会用到
remoteDomain: '10.22.24.195',
// 指定一个远程目录
// 注:必须以 / 开头
// 支持两种模式:
// 1、普通模式,上传的文件将直接存放到该路径下。
// 如:'/test/first'
// 2、字符串匹配模式,该模式会将[date]和[random]替换成当前日期和随机数。
// 当字符串中有[random]时,会询问是否手动输入一个值替换随机数
// 如:'/test/[date]' 或 '/test/[date]/[random]'
remotePath: '/image_site/event/2019/07/activity/tvScreenXian/config/11111',
// autoRemotePath: true, // 跳过询问远程目录,默认false
// autoOverwirte: true, // 跳过询问覆盖已有目录,默认false
// 支持同时上传多个文件,建议2~3个
threads: 3,
// 指定一个本地目录
// 这里必须是一个绝对路径
localPath: path.resolve(__dirname, 'activity/tvScreenXian/config/11111'),
// ftp登录的账号密码等信息
host:"10.22.24.195",
user:"freya",
password:"",
port:"21"
// 上传完成的回调
/*success: function (res) {
console.log(res)
}*/
})
// 初始化准备工作
ftpUpload.init().on('ready', function (res) {
// 处理一些逻辑...
// ...
setTimeout(() => {
// 开始上传文件
// this.start(res.remoteDestPath)
}, 3000)
})
// 文件上传成功
ftpUpload.on('success', function (res) {
console.log(res)
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.