-
-
Save tpolecat/75afdb7cfbe162d418f8266de51f7e26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val store = | |
Stream.bracket(IO(AmazonS3ClientBuilder.standard().build()))( | |
c => Stream.emit(S3Store[IO](c)), | |
a => IO(a.shutdown()) | |
) | |
val prog1 = | |
store.flatMap { s3 => | |
s3.list(Path("org.tpolecat.test1")) | |
.map(_.toString) | |
.through(text.utf8Encode) | |
.to(io.stdout) | |
} | |
val prog2 = | |
store.flatMap { s3 => | |
Stream("hello") | |
.covary[IO] | |
.through(text.utf8Encode) | |
.to(s3.put(Path("org.tpolecat.test1/foo"))) | |
} | |
prog1.compile.drain.unsafeRunSync // works, lists contents of bucket | |
prog2.compile.drain.unsafeRunSync // warns about content size and then hangs | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment