本文整理汇总了TypeScript中ftp.end函数的典型用法代码示例。如果您正苦于以下问题:TypeScript end函数的具体用法?TypeScript end怎么用?TypeScript end使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了end函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
ftp.put(readStream, file.path, (err) => {
if (err) {
deferred.reject(err);
}
ftp.end();
deferred.resolve({});
});
示例2: alert
client.list((err, list) => {
if (err) console.error(err);
console.dir(list);
client.end();
alert("Connection Successful");
});
示例3: function
c.mkdir(remoteDirectory, true, function (err) {
if (err) {
c.end();
failTask('Unable to create remote directory: ' + remoteDirectory + ' due to error: ' + err);
}
directoriesProcessed++;
checkDone('remote directory successfully created/verified: ' + remoteDirectory);
});
示例4: checkDone
function checkDone(message: string): void {
var total: number = filesUploaded + filesSkipped + directoriesProcessed;
var remaining: number = files.length - total + 1; // add one for the root remotePath
console.log(
'files uploaded: ' + filesUploaded +
', files skipped: ' + filesSkipped +
', directories processed: ' + directoriesProcessed +
', total: ' + total + ', remaining: ' + remaining +
', '+message);
if (remaining == 0) {
c.end();
tl.setResult(tl.TaskResult.Succeeded, 'FTP upload successful' + getFinalStatusMessage());
}
}
示例5: resolve
ftp.list(jdfPath, (err, list) => {
if (err) {
ftp.end();
console.log(err);
resolve(localStat);
} else {
const index = indexOfJdf(list);
if (index >= 0) {
const remoteStat = list[indexOfJdf(list)];
if (localStat
&& (localStat.size === parseInt(remoteStat.size)
&& localStat.mtime.getTime() == remoteStat.date.getTime())) {
ftp.end();
resolve(localStat);
} else {
ftp.get(remoteJdfPath, (err, stream) => {
if (err) {
ftp.end();
console.log(err);
resolve(localStat);
} else {
stream.once("close", () => {
ftp.end();
});
stream.pipe(fs.createWriteStream(localJdfPath).once("close", () => {
fs.utimesSync(localJdfPath, new Date, remoteStat.date);
resolve(getFileStat(localJdfPath));
}));
}
});
}
} else {
ftp.end();
resolve(localStat);
}
}
});
示例6:
client.on('ready', () => {
logger.emit('Connected to FTP Server');
files.forEach((commitFile) => {
if(commitFile.Status === 'A' || commitFile.Status === 'M') {
logger.emit('Uploading: ' + rootPath + commitFile.FileName);
logger.emit('To: ' + ftpRootFolder + commitFile.FileName);
client.put(rootPath + commitFile.FileName, ftpRootFolder + commitFile.FileName, (err) => {
if(err) {
logger.emit('ERROR: ' + err);
} else {
logger.emit('Upload successful: ' + commitFile.FileName);
}
});
}
});
client.end();
});