How to download large files (>1GB) with Java

1,501 views
Skip to first unread message

Đình Vũ

unread,
Feb 4, 2021, 2:23:20 AM2/4/21
to MicroProfile
Hi guys,
I am investigate how to download a large file (size > 1Gb) from MinIO by Java
 Service: 
api.png
But when I call the API. I got the error like this.
log.png

Do you know why it is?
And any best idea to solve this problem?
Thank you,
Vu

Federico Mariani

unread,
Feb 4, 2021, 3:08:04 AM2/4/21
to MicroProfile
Hi,
you shouldn't return tye byte[] but the Stream straight, in this way the 1GB file won't be loaded into memory. Maybe StreamingOutput api can help. I think that using OutputStream instead of byte[] is always a best practice.
Regards,
Federico
Reply all
Reply to author
Forward
0 new messages