Skip to content

Commit

Permalink
Refactor file upload and download methods to return promises instead …
Browse files Browse the repository at this point in the history
…of awaiting them

Signed-off-by: worksofliam <[email protected]>
  • Loading branch information
worksofliam committed Jan 13, 2025
1 parent e7561c8 commit 6fcb4d2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/api/IBMiContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1095,20 +1095,20 @@ export default class IBMiContent {
}
}

async uploadFiles(files: { local: string | Uri, remote: string }[], options?: node_ssh.SSHPutFilesOptions) {
await this.ibmi.client!.putFiles(files.map(f => { return { local: Tools.fileToPath(f.local), remote: f.remote } }), options);
uploadFiles(files: { local: string | Uri, remote: string }[], options?: node_ssh.SSHPutFilesOptions) {
return this.ibmi.client!.putFiles(files.map(f => { return { local: Tools.fileToPath(f.local), remote: f.remote } }), options);
}

async downloadFile(localFile: string | Uri, remoteFile: string) {
await this.ibmi.client!.getFile(Tools.fileToPath(localFile), remoteFile);
downloadFile(localFile: string | Uri, remoteFile: string) {
return this.ibmi.client!.getFile(Tools.fileToPath(localFile), remoteFile);
}

async uploadDirectory(localDirectory: string | Uri, remoteDirectory: string, options?: node_ssh.SSHGetPutDirectoryOptions) {
await this.ibmi.client!.putDirectory(Tools.fileToPath(localDirectory), remoteDirectory, options);
uploadDirectory(localDirectory: string | Uri, remoteDirectory: string, options?: node_ssh.SSHGetPutDirectoryOptions) {
return this.ibmi.client!.putDirectory(Tools.fileToPath(localDirectory), remoteDirectory, options);
}

async downloadDirectory(localDirectory: string | Uri, remoteDirectory: string, options?: node_ssh.SSHGetPutDirectoryOptions) {
await this.ibmi.client!.getDirectory(Tools.fileToPath(localDirectory), remoteDirectory, options);
downloadDirectory(localDirectory: string | Uri, remoteDirectory: string, options?: node_ssh.SSHGetPutDirectoryOptions) {
return this.ibmi.client!.getDirectory(Tools.fileToPath(localDirectory), remoteDirectory, options);
}
}

Expand Down

0 comments on commit 6fcb4d2

Please sign in to comment.