forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse-torrent.d.ts
42 lines (36 loc) · 1.36 KB
/
parse-torrent.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Type definitions for parse-torrent
// Project: https://github.com/feross/parse-torrent
// Definitions by: Bazyli Brzóska <https://invent.life>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path='../node/node.d.ts' />
declare namespace ParseTorrent {
export interface ParsedTorrent {
infoHash:string;
xt?:string;
info?: { length:number, name:Buffer, 'piece length':number, pieces:Buffer };
infoBuffer?:Buffer;
name?:string;
private?:boolean;
created?:Date;
comment?:string;
announce?:Array<string>;
urlList?:Array<string>;
files?:Array<{path:string, name:string, length: number, offset:number}>;
length?:number;
pieceLength?:number;
lastPieceLength?:number;
pieces?:Array<string>;
}
interface StaticInstance {
(magnetUriOrInfoHash:string):ParsedTorrent;
(torrentFileOrInfoHash:Buffer):{ info:ParsedTorrent };
toMagnetURI(parsedTorrent:ParsedTorrent):string;
toTorrentFile(parsedTorrent:{ info:ParsedTorrent }):Buffer;
remote(remoteURLorLocalTorrentPath:string, onTorrentCallback?:(err:Error, parsedTorrent:ParsedTorrent)=>void):void;
remote(torrentBlob:Blob, onTorrentCallback?:(err:Error, parsedTorrent:ParsedTorrent)=>void):void;
}
}
declare module "parse-torrent" {
const parseTorrentStatic:ParseTorrent.StaticInstance;
export = parseTorrentStatic;
}