[go-nuts] Re: Serve large files

2017-02-28 Thread Tamás Gulácsi
A "defer streamPDFbytes.Close()" is missing - you'll run out of file descriptors... -- 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

[go-nuts] Re: Serve large files

2017-02-28 Thread Christian Joergensen
Hello, I'd recommend you take a look at: https://godoc.org/net/http#ServeFile This also gives you support for range requests and other goodies. Cheers, Christian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] Re: Serve large files

2017-02-28 Thread Jesse McNelis
Try using os.Open to get a *File (which implements io.Reader), and then > io.Copy to the response from the file. > You should use https://golang.org/pkg/net/http/#ServeFile that's what it does. It will also handle requests with range headers for allowing the client to fetch just a part of the

[go-nuts] Re: Serve large files

2017-02-28 Thread Jordan Krage
Try using os.Open to get a *File (which implements io.Reader), and then io.Copy to the response from the file. On Tuesday, February 28, 2017 at 5:13:20 AM UTC-6, Jeffrey Smith wrote: > > I'm trying to server up a file that can be very large so would like to try > and stream the content back. >