alfred icon indicating copy to clipboard operation
alfred copied to clipboard

Added Range request support to the File handler

Open redsolver opened this issue 4 years ago • 2 comments
trafficstars

Useful for

  • streaming long videos
  • resumable downloads
  • and more...

The implementation is based on https://github.com/dukefirehawk/angel/blob/master/packages/static/lib/src/virtual_directory.dart and adapted to Alfred.

redsolver avatar Jun 05 '21 19:06 redsolver

Hey I just wanted to comment on this one - I am totally in favour of adding this feature, but I'm hesitant to drag in another dependency, especially as its something from angel that may not pan out - just being a small moving part of a larger whole.

I had a quick google shortly after you submitted it and it seems like returning a part of a file stream is pretty straightforward when you do an openread, and the spec according to mozilla is just to return a different status code, a header that says you can, and the portion of the file being returned.

So basically I want to have a go at building it out. I don't think it would take more than a dozen or so lines of code to implement unless I am totally misunderstanding the requirement - and I did have a look at the implementation from the framework which just looks enormous!

So anyway, I haven't forgotten it, I just haven't had a chance to circle back around to it yet.

rknell avatar Jun 17 '21 23:06 rknell

I only added the angel3_range_header dependency which parses the range header. Apart from parsing the range header, my implemenation just returns a part of a file stream and sets some additional headers.

angel3_range_header is pretty small, it's just 6 files, well documented, well tested and standards-compliant. I don't see a reason not to use it. Even if it gets changed in an unwanted way, you could just fork it or copy the header parsing code over.

redsolver avatar Jun 19 '21 13:06 redsolver