-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
Blocks associated with file #71
Comments
In torrent-stream, this is handled by the storage backend. https://github.com/mafintosh/torrent-stream/blob/master/lib/storage.js Unfortunately, the var fileStart = file.offset;
var fileEnd = file.offset + file.length;
var firstPiece = Math.floor(fileStart / pieceLength);
var lastPiece = Math.floor((fileEnd - 1) / pieceLength); |
@galedric @jaruba How can I get the pieceLength in this example? |
Should work, I didn't test it though. |
@jaruba Thank! Sorry for late response. I must have missed the notification. Also, how is @galedric is getting his |
In a multi-file torrent (read: not typical movie torrents as used with peerflix, popcorn time, etc., i.e. music albums,) how would I find the blocks (piece-indexes) associated with each file?
Specifically: engine.on('download') emits a piece-index; how do I know where that lies within a file? That is, is there a way to tell that a file consists of blocks 52-79?
Thanks for reading. I'll document as I figure this out.
The text was updated successfully, but these errors were encountered: