Closed RangerMauve closed 2 years ago
Ya, I'm not happy with the current api here either. I think we should add a live flag instead of the -1 thing to make it super clear (defaults to false). wdyt about something like that?
I think a live flag would be great. Defaulting it to false sounds like it'd be more intuitive, too. I kinda got what -1
meant from looking at the sparse
flag in the constructor, but it was a lucky guess. 😅
changed in 10
When you invoke
core.download(cb)
without specifying astart
andend
, it never invokes yourcb
.Here's a rough example with
hyper-sdk
:I think this is due to
end
getting set to-1
here which means it'll keep downloading new bits of data and never be finished.I propose changing the default range to
this.length
so that thedownload()
completes after the current data has been downloaded. I think this would be a breaking change.An alternative might be to document that the
cb
won't get invoked if you don't specify anend
so that folks don't get tripped up by it (spent 20 mins adding debug statements all over the place wondering why I was stuck 😂 ).