@trap_stevo/filetide 0.0.17 → 0.0.18
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.
|
@@ -28,7 +28,7 @@ class FileMessagerClient {
|
|
|
28
28
|
transports: ["websocket"],
|
|
29
29
|
...options
|
|
30
30
|
});
|
|
31
|
-
console.log(
|
|
31
|
+
console.log(`\n[FileTide ~ File Messager] ~ Created client with ID ${clientID} and socket ${clientID}!`);
|
|
32
32
|
return clientID;
|
|
33
33
|
}
|
|
34
34
|
joinRoom(userID, roomName, options = {}) {
|
|
@@ -36,7 +36,7 @@ class FileMessagerClient {
|
|
|
36
36
|
url: this.clientOptions.url
|
|
37
37
|
}, options);
|
|
38
38
|
this.clientTide.joinChannel(socketName, roomName, userID, () => {
|
|
39
|
-
console.log(
|
|
39
|
+
console.log(`\n[FileTide ~ File Messager] ~ Client ~ ${userID} joined room ${roomName} successfully!`);
|
|
40
40
|
this.clients.set(userID, {
|
|
41
41
|
roomName
|
|
42
42
|
});
|
|
@@ -59,7 +59,7 @@ class FileMessagerClient {
|
|
|
59
59
|
const fileDestinationPath = path.join(adjustedDestinationPath, relativeFilePath);
|
|
60
60
|
return this.sendFile(clientID, recipientId, fileInfo.fileName, fileInfo.fileData, fileDestinationPath);
|
|
61
61
|
});
|
|
62
|
-
Promise.all(sendFilePromises).then(() => console.log("
|
|
62
|
+
Promise.all(sendFilePromises).then(() => console.log("\nAll files in directory transferred successfully!")).catch(error => console.error("Did not transfer files: ", error));
|
|
63
63
|
}
|
|
64
64
|
sendFile(clientID, recipientId, fileName, file, filePath = process.cwd()) {
|
|
65
65
|
console.log(fileName, ": ", file);
|
|
@@ -78,18 +78,12 @@ class FileMessagerClient {
|
|
|
78
78
|
chunkIndex,
|
|
79
79
|
filePath
|
|
80
80
|
});
|
|
81
|
-
console.log(
|
|
81
|
+
console.log(`\nChunk ${chunkIndex} sent successfully!`);
|
|
82
82
|
resolve();
|
|
83
83
|
});
|
|
84
84
|
},
|
|
85
85
|
onComplete: () => {
|
|
86
86
|
return new Promise((resolve, reject) => {
|
|
87
|
-
console.log({
|
|
88
|
-
senderID: clientID,
|
|
89
|
-
recipientId,
|
|
90
|
-
fileName,
|
|
91
|
-
filePath
|
|
92
|
-
});
|
|
93
87
|
this.clientTide.emitEvent(clientID, "transfer-complete", {
|
|
94
88
|
senderID: clientID,
|
|
95
89
|
recipientId,
|
|
@@ -100,7 +94,7 @@ class FileMessagerClient {
|
|
|
100
94
|
});
|
|
101
95
|
},
|
|
102
96
|
onProgress: progress => {
|
|
103
|
-
console.log(
|
|
97
|
+
console.log(`\n[FileTide ~ File Messager] ~ Progress: ${progress.toFixed(2)}%`);
|
|
104
98
|
},
|
|
105
99
|
fileDetails: {
|
|
106
100
|
name: fileName,
|
|
@@ -110,14 +104,14 @@ class FileMessagerClient {
|
|
|
110
104
|
}
|
|
111
105
|
onFileChunkReceived(userID) {
|
|
112
106
|
this.clientTide.onEvent(userID, "transfer-progress", data => {
|
|
113
|
-
console.log(
|
|
114
|
-
console.log("[FileTide ~ File Messager] ~ Progress: ", data.progress);
|
|
107
|
+
console.log(`\n[FileTide ~ File Messager] ~ Receiving file chunk for client ~ ${userID}: `, data.fileChunk);
|
|
108
|
+
console.log("\n[FileTide ~ File Messager] ~ Progress: ", data.progress);
|
|
115
109
|
FileUtilityManager.saveChunk(userID, data.fileChunk, data.path, data.name);
|
|
116
110
|
});
|
|
117
111
|
}
|
|
118
112
|
onFileTransferComplete(userID) {
|
|
119
113
|
this.clientTide.onEvent(userID, "transfer-complete", data => {
|
|
120
|
-
console.log(
|
|
114
|
+
console.log(`\n[FileTide ~ File Messager] ~ File transfer completed for user ${userID}.`);
|
|
121
115
|
FileUtilityManager.assembleFile(userID);
|
|
122
116
|
});
|
|
123
117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
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": {
|