Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChromeChunkStore experimental #1724

Open
kocoten1992 opened this issue Apr 19, 2017 · 5 comments
Open

ChromeChunkStore experimental #1724

kocoten1992 opened this issue Apr 19, 2017 · 5 comments

Comments

@kocoten1992
Copy link
Contributor

@kocoten1992 kocoten1992 commented Apr 19, 2017

I'm writing a plugin to get around chrome limitation (1.8GB in memory before it crash), it was able to download 2.2GB in chrome (theoretically it could go up to 20% of available storage)

https://gist.github.com/kocoten1992/ad3af01bb3b0a257775ae6277081deab

One big caveat, have to build up storage upfront, eg. if torrent have:

8e79d607fce0a41976e4ace19f32d36284fe9cc2 // infoHash
2176931963 //length

Need to create a file name 8e79d607fce0a41976e4ace19f32d36284fe9cc2 and fill it with gibberish data of length 2176931963 (don't know if there are option to this, chrome local file api are real weak)

Then:

var client = new WebTorrent
var opts = {
  store: ChromeChunkStore
}
client.add(torrentId, opts, function (torrent) {
  // despite being weak, it seem to have ability to store much data
  // after done download, go to
  // filesystem:http://example.com/temporary/8e79d607fce0a41976e4ace19f32d36284fe9cc2
  // to get your file
})
@kocoten1992

This comment has been minimized.

Copy link
Contributor Author

@kocoten1992 kocoten1992 commented Apr 20, 2017

update code*

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 21, 2017

Nice, have you tried other options like https://www.npmjs.com/package/idb-chunk-store ?

@kocoten1992

This comment has been minimized.

Copy link
Contributor Author

@kocoten1992 kocoten1992 commented Apr 22, 2017

Hi senpai, I'm testing it right now as you mention it, but why you haven't integrated it into webtorrent yet, is there limitation ? It would take week to try it out, your input is much appreciated

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 22, 2017

Some folks have had success with it. @DiegoRBaquero have you used it? If it's stable enough, I would support it being integrated into webtorrent core.

@kocoten1992

This comment has been minimized.

Copy link
Contributor Author

@kocoten1992 kocoten1992 commented Apr 30, 2017

Idb work pretty nice on firefox, occasionally freeze UI on chrome, think it would better if rewrite use web worker.

One thing bug me, videostream only support MP4, and IndexedDB can't be transform to Blob URL (?), if videostream support more format, this could really be a viable choice.

As for now, with the approach upper, file instanceof File // true we could do a Blob URL, but my code upper have bug that when it done download, it not seeding back (getting request time out ? don't know how to fix).

@feross feross transferred this issue from another repository Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.