As part of my learning process I recently started a new challenge to create a photomosaics web app with golang. Since I am planning on hosting it on App Engine I divided it into 2 services: 1 to handle image uploads and the other to handle image processing. What I want to accomplish here is to start processing the image as soon as the first bytes are received. While doing my research I came across this gist cryptix/client.go. I need to use this method to read the request into a io.Pipe and then stream it on the fly to my image processing service and none of my googling helped: all there is to see is a GO client sending files while I want a Go server receiving files.
NOTE:
Somewhat reluctant to answer this as i'm not sure what the exact problem is or what you have tried.
But this is just a streaming http read.
A http.Request actually holds the request body in a io.ReadCloser. This means that standard io.Reader implementations can stream this.
What you need to do is create a function that processes your data.
func process(r io.Reader) {
// do something
}
then you can read it from the http handler
func(w http.ResponseWriter, r *http.Request) {
process(r.Body)
}
Without knowing your exact question or what you need help with I cannot elaborate further.