🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

bt-stream

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bt-stream

bittorrent read-stream implementation without writing to storage

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
1
-50%
Maintainers
2
Weekly downloads
 
Created
Source

bt-stream

BitTorrent read-stream implementation without writing to storage

Example

const BTStream = require('bt-stream');
const fs = require('fs');

const DHT_PORT = 8080;
const HASH = '4309ff009fb1648b2d1e9f67f240bd0dcfe3b0fc';//require('url').parse(req.url, true).query.hash;

const btStream = new BTStream({ dhtPort: DHT_PORT });
const torrent = await btStream.getMetaData(HASH);

console.log('Metadata downloaded:');
console.log('Files:', torrent.files);
console.log('Pieces count:', torrent.pieces.length);
console.log('Piece length:', torrent.pieceLength);
console.log('hash=', torrent.infoHash);

const readStream = await btStream.downloadTorrent(torrent);

const writeStream = fs.createWriteStream(FILE_PATH);
readStream.pipe(writeStream);

Keywords

bittorrent

FAQs

Package last updated on 17 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts