0.0.1 • Published 10 years ago
mock-webtorrent v0.0.1
mock-webtorrent
Use like you would use feross/webtorrent.
example
what you would do with actual webtorrent
var WebTorrent = require('webtorrent')
var client1 = new WebTorrent()
var client2 = new WebTorrent() // Note this line...
client1.seed(...)
client2.download(...)what you do with this mock
var WebTorrent = require('mock-webtorrent')
var client1 = new WebTorrent()
var client2 = client1 // Note this line...
client1.seed(...)
client2.download(...)api
client.destroy()
client.remove(infoHash)
infoHashis a string, e.g.'01a6faadd5d05e3af27dff2424e0a99bdeb825fc'
client.seed(files, cb(torrent))
filesis an array of filename strings, e.g.[ 'file1.txt', 'awesome.avi' ]cbis a callback function that has the argumenttorrent
client.add(infoHash, [config,] cb(torrent))
client.download(infoHash, [config,] cb(torrent))
infoHashis a string, e.g.'01a6faadd5d05e3af27dff2424e0a99bdeb825fc'configis an optional object that doesn't do anything in this mockcbis a callback function that has the argumenttorrent
torrent
torrent.infoHashtorrent.files
file
nameis a string of the filename, e.g.'awesome.avi'getBlobURL()is a function that returns a string of the blob URLcreateReadStream()is a function that returns a read stream of the file
install
With npm do:
npm install mock-webtorrenttodo
- tests
- travis-ci
- implement more of the webtorrent api, as needed
license
0.0.1
10 years ago