Guest User

Untitled

a guest
Feb 15th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. async execute(event: ImportFilesEvent): Promise<void> {
  2. const ftpConfig = await this.readFtpConfiguration();
  3. this.ftp.configure(ftpConfig);
  4. await this.ftp.connect();
  5. const files = await this.ftp.list(event.ftp_path);
  6. for (const ftpFile of files) {
  7. const fileStream = await this.ftp.get(`${event.ftp_path}/${ftpFile.name}`);
  8. await this.s3.put(fileStream, ftpFile.name, event.s3_bucket);
  9. await this.ftp.delete(`${event.ftp_path}/${ftpFile.name}`);
  10. }
  11. this.ftp.disconnect();
  12. }
Add Comment
Please, Sign In to add comment