當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ssh2-sftp-client.put函數代碼示例

本文整理匯總了TypeScript中ssh2-sftp-client.put函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript put函數的具體用法?TypeScript put怎麽用?TypeScript put使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了put函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: callback

	const uploadQueue = async.priorityQueue<UploadPayload, Error>(({ localPath, observer, remotePath, title }, callback) => {
		uploadQueue.drain = () => observer.complete()
		const remainingCount = uploadQueue.length()
		const inProgressTitles = uploadQueue.workersList()
			.map(worker => worker.data.title)
			.sort()
			.map(title => title.length <= 27 ? title : `${title.substr(0, 12)}...${title.slice(-12)}`)
		const message = inProgressTitles.join(', ') + (remainingCount ? ` + ${remainingCount} more` : '')
		observer.next(message)
		sftp.put(localPath, remotePath, true).then(() => callback()).catch(callback)
	}, 4)
開發者ID:MsDacia,項目名稱:msdacia,代碼行數:11,代碼來源:deploy.ts

示例2: Client

import * as Client from 'ssh2-sftp-client';
var client = new Client();

client.connect({
    host: 'asdb',
    port: 1234,
    privateKey: 'my private key rsa in openssh format',
    readyTimeout: 1000,
}).then(() => null);

client.list('/remote/path').then(() => null);

client.get('/remote/path').then(stream => stream.read(0));

client.put('/local/path', '/remote/path').then(() => null);

client.put(new Buffer('content'), '/remote/path').then(() => null);

client.mkdir('/remote/path/dir', true).then(() => null);

client.delete('remote/path').then(() => null);

client.rename('/remote/from', '/remote/to').then(() => null);

client.end().then(() => null);
開發者ID:DenisCarriere,項目名稱:DefinitelyTyped,代碼行數:25,代碼來源:ssh2-sftp-client-tests.ts

示例3: Client

import * as Client from 'ssh2-sftp-client';
import * as fs from 'fs';
const client = new Client();

client.connect({
    host: 'asdb',
    port: 1234,
    privateKey: 'my private key rsa in openssh format',
    readyTimeout: 1000,
}).then(() => null);

client.list('/remote/path').then(() => null);

client.get('/remote/path').then(stream => stream.read(0));
client.get('/remote/path', true, 'binary').then(stream => stream.read(0));

client.put('/local/path', '/remote/path').then(() => null);
client.put(new Buffer('content'), '/remote/path').then(() => null);
client.put(fs.createReadStream('Hello World'), '/remote/path').then(() => null);

client.mkdir('/remote/path/dir', true).then(() => null);
client.rmdir('/remote/path/dir', true).then(() => null);

client.delete('remote/path').then(() => null);

client.rename('/remote/from', '/remote/to').then(() => null);

client.end().then(() => null);
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:28,代碼來源:ssh2-sftp-client-tests.ts


注:本文中的ssh2-sftp-client.put函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。