Go web server: serving big files

409 views
Skip to first unread message

Tharaneedharan Vilwanathan

unread,
Jul 10, 2018, 7:00:46 PM7/10/18
to golang-nuts
Hi,

I was just trying to serve a big file (about 10GB) from Go web server (beego, actually). Looks like it tries to read the full file into memory and then serve it. Is that right? Is it a problem if I dont have enough memory? Any thoughts?

Regards
dharani


Shawn Milochik

unread,
Jul 10, 2018, 7:11:07 PM7/10/18
to golang-nuts
Open the file and use io.Copy on it and the response writer. 👍

Thomas Bushnell, BSG

unread,
Jul 10, 2018, 7:22:21 PM7/10/18
to Sh...@milochik.com, golang-nuts
If you use the standard library function in the http package (ServeContent), you won't have this problem.

On Tue, Jul 10, 2018 at 4:10 PM Shawn Milochik <shawn...@gmail.com> wrote:
Open the file and use io.Copy on it and the response writer. 👍

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tharaneedharan Vilwanathan

unread,
Jul 10, 2018, 7:25:33 PM7/10/18
to tbus...@google.com, Sh...@milochik.com, golang-nuts
That's great to know! I can try it immediately.

Thanks
dharani
Reply all
Reply to author
Forward
0 new messages