internalfx/rethinkdb-regrid

File Range selection

Closed this issue · 3 comments

Hi all
Is it possible to give the readstream (download function) a start/end range to retrieve a chunk of a file like in gridfs (mongodb)?

var fileID = '661ec4ac-2afa-404b-88ca-c566394d07af';
var rangeOptions = { start: 0, end: 28930};
var file = bucket.downloadId(fileID, rangeOptions);

something like this?
Thanks

Hi
I have found something in your documentation but it is only for the C# driver. Are you planning to update the JS version also?

Seekable Download Streams

ReGrid supports starting downloads at an offset by seeking into part of a large file.

 var opts = new DownloadOptions {Seekable = true};

 using( var stream = bucket.OpenDownloadStream("/video.mp4", options: opts) )
{
    stream.Seek( 1024 * 1024 * 20, SeekOrigin.Begin);

    //start reading 20MB into the file...
}

The Data format specifically allows this.

But it has not been implemented yet.

It is on the radar, but may be some time before it lands.

Seekable downloads are now pushed to latest master