Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async execute(event: ImportFilesEvent): Promise<void> {
- const ftpConfig = await this.readFtpConfiguration();
- this.ftp.configure(ftpConfig);
- await this.ftp.connect();
- const files = await this.ftp.list(event.ftp_path);
- for (const ftpFile of files) {
- const fileStream = await this.ftp.get(`${event.ftp_path}/${ftpFile.name}`);
- await this.s3.put(fileStream, ftpFile.name, event.s3_bucket);
- await this.ftp.delete(`${event.ftp_path}/${ftpFile.name}`);
- }
- this.ftp.disconnect();
- }
Add Comment
Please, Sign In to add comment