-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: GridFS, Networking, Performance
-
None
Context
As the client, I should have the flexibility of choosing to stream a file in it's entirety or in parts, such as using a Range Request
Here is the current definition of the DownloadStream
func (ds *DownloadStream) Skip(skip int64) (int64, error)
Whereas the http.ServeContent function requires a an `io.ReadSeeker`. From the docs, it seem this is the recommended function to use over `io.Copy` as it:
handles Range requests properly, sets the MIME type, and handles If-Match, If-Unmodified-Since, If-None-Match, If-Modified-Since, and If-Range requests.
By extending the type to implement the `ReadSeeker` interface, this creates greater consistency with the stdlib
Definition of done
Include a method for seeking. This seems to exists in s3 compatible drivers already and this older unofficial MongoDB driver seemed to also implement this. The official driver also already seems to tackle the SeekStart/SeekCurrent with how Skip is implemented.
Pitfalls
What should the implementer watch out for? What are the risks?