本文整理匯總了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();
});