filepizza-client 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -4
- package/dist/filepizza-downloader.d.ts +18 -100
- package/dist/filepizza-downloader.js +88 -215
- package/dist/filepizza-downloader.js.map +1 -1
- package/dist/filepizza-uploader.d.ts +14 -95
- package/dist/filepizza-uploader.js +79 -249
- package/dist/filepizza-uploader.js.map +1 -1
- package/dist/peerjs.d.ts +12 -0
- package/dist/peerjs.js +85 -0
- package/dist/peerjs.js.map +1 -0
- package/dist/types.d.ts +6 -2
- package/dist/types.js +4 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/filepizza-downloader.ts +373 -459
- package/src/filepizza-uploader.ts +237 -391
- package/src/peerjs.ts +125 -0
- package/src/types.ts +37 -28
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { EventEmitter } from './event-emitter';
|
|
2
|
-
import { ConnectionInfo } from './types';
|
|
2
|
+
import { ConnectionInfo, PeerJSSignalingServer } from './types';
|
|
3
|
+
type UploaderOptions = {
|
|
4
|
+
filePizzaServerUrl?: string;
|
|
5
|
+
password?: string;
|
|
6
|
+
sharedSlug?: string;
|
|
7
|
+
peerJSSignalingServer?: PeerJSSignalingServer;
|
|
8
|
+
discoverPeerJSSignalingServer?: boolean;
|
|
9
|
+
};
|
|
3
10
|
/**
|
|
4
|
-
* FilePizza Uploader - connects to the FilePizza server and uploads files
|
|
11
|
+
* FilePizza Uploader - connects to the FilePizza server and uploads files.
|
|
5
12
|
*/
|
|
6
13
|
export declare class FilePizzaUploader extends EventEmitter {
|
|
7
14
|
private peer?;
|
|
@@ -12,127 +19,39 @@ export declare class FilePizzaUploader extends EventEmitter {
|
|
|
12
19
|
private filePizzaServerUrl;
|
|
13
20
|
private channelInfo?;
|
|
14
21
|
private sharedSlug?;
|
|
15
|
-
private iceServers?;
|
|
16
22
|
private renewalTimer?;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
constructor(options?: {
|
|
22
|
-
filePizzaServerUrl?: string;
|
|
23
|
-
password?: string;
|
|
24
|
-
sharedSlug?: string;
|
|
25
|
-
});
|
|
26
|
-
/**
|
|
27
|
-
* Initialize the uploader
|
|
28
|
-
*/
|
|
23
|
+
private peerJSSignalingServer?;
|
|
24
|
+
private discoverPeerJSSignalingServer;
|
|
25
|
+
constructor(options?: UploaderOptions);
|
|
29
26
|
initialize(): Promise<void>;
|
|
30
27
|
setPassword(password: string): void;
|
|
31
|
-
/**
|
|
32
|
-
* Set files to be shared
|
|
33
|
-
*/
|
|
34
28
|
setFiles(files: File[]): void;
|
|
35
|
-
/**
|
|
36
|
-
* Get shareable links for the current channel
|
|
37
|
-
*/
|
|
38
29
|
getShareableLinks(): {
|
|
39
30
|
long: string;
|
|
40
31
|
short: string;
|
|
41
32
|
} | null;
|
|
42
|
-
/**
|
|
43
|
-
* Stop sharing and clean up
|
|
44
|
-
*/
|
|
45
33
|
stop(): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Get ICE servers from the FilePizza server
|
|
48
|
-
*/
|
|
49
|
-
private getIceServers;
|
|
50
|
-
/**
|
|
51
|
-
* Create a new channel on the FilePizza server
|
|
52
|
-
*/
|
|
53
34
|
private createChannel;
|
|
54
|
-
/**
|
|
55
|
-
* Renew the channel to keep it alive
|
|
56
|
-
*/
|
|
57
35
|
private renewChannel;
|
|
58
|
-
/**
|
|
59
|
-
* Destroy a channel
|
|
60
|
-
*/
|
|
61
36
|
private destroyChannel;
|
|
62
|
-
/**
|
|
63
|
-
* Start channel renewal
|
|
64
|
-
*/
|
|
65
37
|
private startChannelRenewal;
|
|
66
|
-
/**
|
|
67
|
-
* Handle new connection
|
|
68
|
-
*/
|
|
69
38
|
private handleConnection;
|
|
70
|
-
/**
|
|
71
|
-
* Handle data messages from connection
|
|
72
|
-
*/
|
|
73
39
|
private handleData;
|
|
74
|
-
/**
|
|
75
|
-
* Handle connection close
|
|
76
|
-
*/
|
|
77
40
|
private handleClose;
|
|
78
|
-
/**
|
|
79
|
-
* Handle connection error
|
|
80
|
-
*/
|
|
81
41
|
private handleError;
|
|
82
|
-
/**
|
|
83
|
-
* Handle RequestInfo message
|
|
84
|
-
*/
|
|
85
42
|
private handleRequestInfo;
|
|
86
|
-
/**
|
|
87
|
-
* Handle UsePassword message
|
|
88
|
-
*/
|
|
89
43
|
private handleUsePassword;
|
|
90
|
-
/**
|
|
91
|
-
* Handle Start message
|
|
92
|
-
*/
|
|
93
44
|
private handleStart;
|
|
94
|
-
/**
|
|
95
|
-
* Handle Pause message
|
|
96
|
-
*/
|
|
97
45
|
private handlePause;
|
|
98
|
-
|
|
99
|
-
* Handle Resume message
|
|
100
|
-
*/
|
|
101
|
-
private handleResume;
|
|
102
|
-
/**
|
|
103
|
-
* Handle Done message
|
|
104
|
-
*/
|
|
46
|
+
private handleChunkAck;
|
|
105
47
|
private handleDone;
|
|
106
|
-
/**
|
|
107
|
-
* Send file chunks to the downloader
|
|
108
|
-
*/
|
|
109
48
|
private sendFileChunks;
|
|
110
|
-
/**
|
|
111
|
-
* Find a file by name
|
|
112
|
-
*/
|
|
113
49
|
private findFile;
|
|
114
|
-
/**
|
|
115
|
-
* Get file info for all files
|
|
116
|
-
*/
|
|
117
50
|
private getFileInfo;
|
|
118
|
-
/**
|
|
119
|
-
* Get connection info for a specific connection
|
|
120
|
-
*/
|
|
121
51
|
private getConnectionInfo;
|
|
122
|
-
/**
|
|
123
|
-
* Get connection info for all connections
|
|
124
|
-
*/
|
|
125
52
|
getConnectionInfoAll(): ConnectionInfo[];
|
|
126
|
-
/**
|
|
127
|
-
* Remove connection info
|
|
128
|
-
*/
|
|
129
53
|
removeConnectionInfo(connectionId: string): void;
|
|
130
|
-
/**
|
|
131
|
-
* Get total bytes for all files
|
|
132
|
-
*/
|
|
133
54
|
private getTotalBytes;
|
|
134
|
-
/**
|
|
135
|
-
* Get progress info for a specific connection
|
|
136
|
-
*/
|
|
137
55
|
private getProgressInfo;
|
|
138
56
|
}
|
|
57
|
+
export {};
|