@moyphilip wrote:
Hello,
I have been trying to figure a way to download a file from s3. I want to:
- list the files from s3://bucket/key
- filter for csv files.
- write them to a local directory
I have been working with this code but can’t get it to work. I am unfamiliar with how graph works. Can someone point me in the right direction.
val test = S3.listBucket(bucket, Option(key)) .filter(a => a.key.endsWith("csv")) .map(r => S3.download(r.bucketName, r.key)) .to(FileIO.toPath(downloadPath)) .run()
I am trying to make it a Future[Done] so I can call on complete to it and close out the system.
This code works but I dont know how to close out the system after running the graph to completion
val test = s3List .filter(a => a.key.endsWith("csv")) .map(r => S3.download(r.bucketName, r.key)) .flatMapConcat(identity) .collect{case Some(x) => x} .flatMapConcat{case (s, o) => s} .to(FileIO.toPath(downloadPath)) test.run()
Posts: 6
Participants: 2