//读写 FTP 文件流 import inet.ftp; import console; console.showLoading("正在连接 FTP 服务器"); var ftp = inet.ftp("ftp.scene.org"); if(!ftp) return console.errorPause("请输入正确的服务器参数"); //显示当前目录 console.log( ftp.getCurDir() ) //设置服务器启用 UTF8 编码 console.log( ftp.command("OPTS UTF8 ON") ) var file = ftp.open("/welcome.msg","rt"); console.log( file.readAll() ); file.close(); var file,err = ftp.open("/pub/parties/2025/temp25/temp.txt","wb"); console.assert(file,err); //支持文件流方式上传数据,使用循环即可控制上传进度 file.write("写数据","写更多数据",'\r\n'); file.write("写数据","写更多数据",'\r\n') ; ftp.close(); console.pause();