mirror of
https://github.com/certd/certd.git
synced 2026-04-24 20:57:26 +08:00
chore: doc
This commit is contained in:
@@ -45,12 +45,13 @@ export class AsyncSsh2Client {
|
|||||||
async fastPut(options: { sftp: any; localPath: string; remotePath: string }) {
|
async fastPut(options: { sftp: any; localPath: string; remotePath: string }) {
|
||||||
const { sftp, localPath, remotePath } = options;
|
const { sftp, localPath, remotePath } = options;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.logger.info(`上传文件:${localPath} => ${remotePath}`);
|
this.logger.info(`开始上传:${localPath} => ${remotePath}`);
|
||||||
sftp.fastPut(localPath, remotePath, (err: Error) => {
|
sftp.fastPut(localPath, remotePath, (err: Error) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.logger.info(`上传文件成功:${localPath} => ${remotePath}`);
|
||||||
resolve({});
|
resolve({});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -139,12 +140,12 @@ export class SshClient {
|
|||||||
connectConf,
|
connectConf,
|
||||||
callable: async (conn: AsyncSsh2Client) => {
|
callable: async (conn: AsyncSsh2Client) => {
|
||||||
const sftp = await conn.getSftp();
|
const sftp = await conn.getSftp();
|
||||||
|
this.logger.info('开始上传');
|
||||||
for (const transport of transports) {
|
for (const transport of transports) {
|
||||||
this.logger.info('上传文件:', JSON.stringify(transport));
|
|
||||||
await conn.exec(`mkdir -p ${path.dirname(transport.remotePath)} `);
|
await conn.exec(`mkdir -p ${path.dirname(transport.remotePath)} `);
|
||||||
await conn.fastPut({ sftp, ...transport });
|
await conn.fastPut({ sftp, ...transport });
|
||||||
}
|
}
|
||||||
this.logger.info('文件上传成功');
|
this.logger.info('文件全部上传成功');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user