Comments (4)
In torrent-stream, this is handled by the storage backend.
https://github.com/mafintosh/torrent-stream/blob/master/lib/storage.js
Unfortunately, the piecesMap
object is not publicly available. The main logic however is quite simple.
var fileStart = file.offset;
var fileEnd = file.offset + file.length;
var firstPiece = Math.floor(fileStart / pieceLength);
var lastPiece = Math.floor((fileEnd - 1) / pieceLength);
from torrent-stream.
@galedric @jaruba How can I get the pieceLength in this example?
from torrent-stream.
var peerflix = require('peerflix'),
engine = peerflix(magnetLink);
engine.server.on('listening', function() {
console.log('Piece length: ' + engine.torrent.pieceLength);
});
Should work, I didn't test it though.
from torrent-stream.
@jaruba Thank! Sorry for late response. I must have missed the notification.
Also, how is @galedric is getting his file
object?
from torrent-stream.
Related Issues (20)
- Memory leak HOT 2
- Question HOT 2
- File.deselect not working HOT 3
- [DELETED]
- Assertion failed: (uv__stream_fd(stream) >= 0), function uv__read_start_common, file ../deps/uv/src/unix/stream.c
- Read stream buffer size
- Update torrent-discovery Dependency HOT 1
- Problem with directory name when pass options object.
- streaming >4GB-files doesn't come to an end.
- Download speed
- Race condition can result in torrent-stream preventing process exit HOT 3
- Imposible to catch an error HOT 5
- Frequent test failure
- Add Local Peer Discovery (BEP 14)
- pipe to ffmpeg to turn into hls ?
- Hey I am confused HOT 1
- Why there is no engine.on('error') event to handle errors
- Is this suitable for video on demand?
- Download Subs first
- Get download speed and percentage of downloaded files of the total size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torrent-stream.