问题
Downloading a file from S3 storage using Alpakka S3 connector does not provide the whole file, only a part of it. Assuming settings and attributes are correct, since upload works fine, I wonder what could be the reason.
val s3File: Source[Option[(Source[ByteString, NotUsed], ObjectMetadata)], NotUsed] =
S3.download(bucketName, fileName).withAttributes(attributes)
s3File.runWith(Sink.head)(materializer) flatMap {
case Some(result) =>
result._1.runWith(Sink.head)(materializer) map { data =>
Right(data.toArray)
}
case _ => Future.successful(Left("error"))
}
Logging the objects metadata of result
everything looks correct and data are returned, but only a fraction of what's expected.
来源:https://stackoverflow.com/questions/58451046/alpakka-s3-connector-does-not-provide-complete-file