diff --git a/fs2-aws-s3/src/main/scala/fs2/aws/s3/S3.scala b/fs2-aws-s3/src/main/scala/fs2/aws/s3/S3.scala index d54504e5..361185a4 100644 --- a/fs2-aws-s3/src/main/scala/fs2/aws/s3/S3.scala +++ b/fs2-aws-s3/src/main/scala/fs2/aws/s3/S3.scala @@ -116,8 +116,8 @@ object S3 { def uploadFile(bucket: BucketName, key: FileKey, modifier: AwsRequestModifier.Upload1): Pipe[F, Byte, ETag] = in => fs2.Stream.eval { - in.compile.toVector.flatMap { vs => - val bs = ByteBuffer.wrap(vs.toArray) + in.compile.to(Chunk).flatMap { chunks => + val bs = chunks.toByteBuffer s3.putObject( modifier.putObject(PutObjectRequest.builder().bucket(bucket.value).key(key.value)).build(), AsyncRequestBody.fromByteBuffer(bs)