【文件属性】:
文件名称:bittorrent-protocol:简单,可靠,BitTorrent对等有线协议实现
文件大小:15KB
文件格式:ZIP
更新时间:2021-02-03 01:32:28
nodejs javascript torrent browser bittorrent
比特流协议
简单,强大的BitTorrent有线协议实现
Node.js实现。 该协议是BitTorrent文件传输的主要通信层。
也可以在带有的浏览器中使用! 使用此模块。
安装
npm install bittorrent-protocol
用法
该协议被实现为双工流,因此您要做的就是通过管道与之进行双向通信。
双工流
烟斗(b)。烟斗(a)
(来自图像按子堆栈进行讨论。)
const Protocol = require ( 'bittorrent-protocol' )
const net = require ( 'net' )
net . createServer ( socket => {
const wire = new Protocol ( )
// pipe to and from the protocol
socket . pipe ( wire ) . pipe ( socket )
wire . on ( 'handshake' , ( infoHash , peerId ) => {
// receive a handshake (in
【文件预览】:
bittorrent-protocol-master
----package.json(1KB)
----.travis.yml(37B)
----LICENSE(1KB)
----index.js(21KB)
----README.md(9KB)
----.npmignore(18B)
----test()
--------extension.js(3KB)
--------timeout.js(782B)
--------no-timeout.js(774B)
--------protocol.js(5KB)
--------timeout-destroy.js(672B)
--------state-change-on-end.js(983B)