node-locate-torrent-data
Example
var locateTorrentData = ;var fileIndex = locateTorrentDataindex"D:\\Files";var torrentPath = "C:\\Torrents\\memes.torrent";fileIndex;
Installation
npm i locate-torrent-data
API Reference
FileIndex
locate-torrent-data.index(path, [options], [callback]) ⇒ Create a searchable file index from the contents of specified folder(s).
Kind: static method of locate-torrent-data
Emits: error
, update
Params
- path
string
|Array.<string>
- [options]
Object
- [.maxdepth]
number
- [.dereference]
boolean
- [.maxdepth]
- [callback]
function
- .error
Error
- .error
Example
var fileIndex = locateTorrentDataindex"D:\\Files";
FileIndex
locate-torrent-data.load(source, [callback]) ⇒ Import a file index from disk or read from specified stream.
Kind: static method of locate-torrent-data
Emits: error
, update
See: save
Params
- source
string
|Readable
- [callback]
function
- .error
Error
- .error
Example
var fileIndex = locateTorrentData;
FileIndex
Kind: global class
fileIndex.search(torrent, [forEach], [callback]) ↩︎
Search file index for files that match the contents of specified torrent.
Kind: instance method of FileIndex
Chainable
Emits: error
, match
, notFound
, end
, update
Params
- torrent
string
|ParsedTorrent
- [forEach]
function
- .file
TorrentFile
- .callback
function
- .file
- [callback]
function
- .error
Error
- .files
Array.<TorrentFile>
- .error
Example
var torrentPath = "C:\\Torrents\\memes.torrent";var savePath = "D:\\Seeding";var torrent = ;fileIndex;
fileIndex.on(event, callback) ↩︎
Add event listener.
Kind: instance method of FileIndex
Chainable
Params
- event
string
- callback
function
Example
fileIndex ;var torrentPath = "C:\\Torrents";fs;
fileIndex.add(path, [options], [callback]) ↩︎
Add contents of specified folder(s) to the file index.
Kind: instance method of FileIndex
Chainable
Emits: error
, update
Params
- path
string
|Array.<string>
- [options]
Object
- [.maxdepth]
number
- [.dereference]
boolean
- [.maxdepth]
- [callback]
function
- .error
Error
- .error
Example
var fileIndex = locateTorrentDataindex"D:\\Files";fileIndex;
fileIndex.remove(path, [callback]) ↩︎
Remove contents of specified folder(s) from the file index.
Kind: instance method of FileIndex
Chainable
Emits: update
Params
- path
string
|Array.<string>
- [callback]
function
Example
var fileIndex = locateTorrentDataindex"D:\\Files";fileIndex;
fileIndex.save(destination, [callback]) ↩︎
Export file index as csv file to disk at specified path or write to specified stream.
Kind: instance method of FileIndex
Chainable
Emits: error
See: load
Params
- destination
string
|Writable
- [callback]
function
- .error
Error
- .error
Example
fileIndex;
"error" (error)
Kind: event emitted by FileIndex
See: on
Params
- error
Error
"match" (file, torrent)
Kind: event emitted by FileIndex
See: on
Params
- file
TorrentFile
- torrent
ParsedTorrent
"notFound" (file, torrent)
Kind: event emitted by FileIndex
See: on
Params
- file
TorrentFile
- torrent
ParsedTorrent
"end" (files, torrent)
Kind: event emitted by FileIndex
See: on
Params
- files
Array.<TorrentFile>
- torrent
ParsedTorrent
"update"
Kind: event emitted by FileIndex
See: on
TorrentFile
Kind: global class
Properties
- offset
number
- Offset of file inside torrent. - length
number
- File size in bytes. - name
string
- File name inside torrent. - path
string
- Path of file inside torrent. - location
string
- Location on disk of matching file if found.
License
MPL 2.0