@trap_stevo/filetide 0.0.28 → 0.0.29
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/dist/cjs/FileMessagerClient.js +0 -37
- package/dist/cjs/FileTide.js +2 -11
- package/package.json +1 -1
|
@@ -142,43 +142,6 @@ class FileMessagerClient {
|
|
|
142
142
|
}
|
|
143
143
|
}).then(() => FileNetUtilityManager.outputGradient(`[FileTide ~ File Messager] ~ File ~ ${fileName} transfer complete!`, significantMessageColors)).catch(error => FileNetUtilityManager.outputGradient(`Refused file transfer: ${error}`, errorMessageColors));
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
/*onFileChunkReceived(userID)
|
|
147
|
-
{
|
|
148
|
-
this.clientTide.onEvent(userID, "transfer-progress", (data) => {
|
|
149
|
-
console.log(`\n[FileTide ~ File Messager] ~ Receiving file chunk for client ~ ${userID}: `, data.fileChunk);
|
|
150
|
-
|
|
151
|
-
console.log("\n[FileTide ~ File Messager] ~ Progress: ", data.progress);
|
|
152
|
-
|
|
153
|
-
FileUtilityManager.saveChunk(userID, data.fileChunk, data.path, data.name);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
onFileTransferComplete(userID) {
|
|
158
|
-
this.clientTide.onEvent(userID, "transfer-complete", (data) => {
|
|
159
|
-
console.log(`\n[FileTide ~ File Messager] ~ File transfer completed for user ${userID}.`);
|
|
160
|
-
|
|
161
|
-
FileUtilityManager.assembleFile(userID);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
handleIncomingFile(userID)
|
|
166
|
-
{
|
|
167
|
-
this.clientTide.onEvent(userID, "incoming-file", (data) => {
|
|
168
|
-
console.log(`\n[FileTide ~ File Messager] ~ Received file for user ${userID}: ${data.fileName}.`);
|
|
169
|
-
|
|
170
|
-
FileUtilityManager.saveFile(data.fileName, data.fileData, data.path, data.name);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
handleMultipleClientsTransfer()
|
|
175
|
-
{
|
|
176
|
-
this.clients.forEach((userID, roomData) => {
|
|
177
|
-
this.onFileChunkReceived(userID);
|
|
178
|
-
|
|
179
|
-
this.onFileTransferComplete(userID);
|
|
180
|
-
});
|
|
181
|
-
}*/
|
|
182
145
|
}
|
|
183
146
|
;
|
|
184
147
|
module.exports = FileMessagerClient;
|
package/dist/cjs/FileTide.js
CHANGED
|
@@ -71,9 +71,6 @@ class FileTide {
|
|
|
71
71
|
}
|
|
72
72
|
const newClient = new FileMessagerClient(clientOptions);
|
|
73
73
|
newClient.joinRoom(userID, roomName, connectionOptions);
|
|
74
|
-
|
|
75
|
-
//newClient.handleMultipleClientsTransfer();
|
|
76
|
-
|
|
77
74
|
this.clients.set(userID, newClient);
|
|
78
75
|
FileTide.outputGradient(`[FileTide] ~ Messager launched successfully for client ~ ${userID}!`, significantMessageColors);
|
|
79
76
|
_assertClassBrand(_FileTide_brand, this, _setupFileEventListeners).call(this, userID, newClient, onIncomingFile);
|
|
@@ -230,7 +227,7 @@ function _setupFileEventListeners(userID, client, onIncomingFile) {
|
|
|
230
227
|
this.progressBarManager.listenForInput("Page Number:", "Press 'n' for next page, 'p' for previous page.", chalk.blue, chalk.magenta, chalk.yellow);
|
|
231
228
|
});
|
|
232
229
|
client.clientTide.onEvent(userID, "incoming-file", data => {
|
|
233
|
-
|
|
230
|
+
_FileTide.outputGradient(`[${userID}] Preparing to receive file : ${data.fileName}`, significantMessageColors);
|
|
234
231
|
activeTransfers.set(data.fileName, {
|
|
235
232
|
receivedChunks: [],
|
|
236
233
|
totalChunks: data.totalChunks,
|
|
@@ -256,21 +253,15 @@ function _setupFileEventListeners(userID, client, onIncomingFile) {
|
|
|
256
253
|
if (!transferState) {
|
|
257
254
|
return;
|
|
258
255
|
}
|
|
259
|
-
|
|
260
|
-
//console.log(`[${userID}] Receiving chunk ${data.chunkIndex + 1}/${transferState.totalChunks} for file : ${data.fileName}`);
|
|
261
|
-
|
|
262
256
|
transferState.receivedChunks[data.chunkIndex] = Buffer.from(data.fileChunk);
|
|
263
257
|
const progress = (data.chunkIndex + 1) / transferState.totalChunks * 100;
|
|
264
|
-
|
|
265
|
-
//console.log(`[${userID}] Progress : ${progress.toFixed(2)}%`);
|
|
266
|
-
|
|
267
258
|
this.progressBarManager.updateTaskProgress(data.fileName, 512 * 1024);
|
|
268
259
|
if (onIncomingFile) {
|
|
269
260
|
onIncomingFile(data);
|
|
270
261
|
}
|
|
271
262
|
});
|
|
272
263
|
client.clientTide.onEvent(userID, "transfer-complete", data => {
|
|
273
|
-
|
|
264
|
+
_FileTide.outputGradient(`[${userID}] File transfer complete : ${data.fileName}`, significantMessageColors);
|
|
274
265
|
const transferState = activeTransfers.get(data.fileName);
|
|
275
266
|
if (!transferState) {
|
|
276
267
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"description": "Revolutionizing real-time file transfer with seamless, instant communication across any device. Deliver files instantly, regardless of platform, and experience unparalleled speed and control in managing transfers. Elevate your file-sharing capabilities with a tool designed for precision, efficiency, and effortless connectivity.",
|
|
5
5
|
"main": "dist/cjs/FileTide.js",
|
|
6
6
|
"scripts": {
|