@trap_stevo/filetide 0.0.26 → 0.0.28
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/FileMessager.js +6 -5
- package/dist/cjs/FileMessagerClient.js +56 -30
- package/dist/cjs/FileTide.js +56 -75
- package/dist/cjs/HUDComponents/ConsoleProgressBarManager.js +1 -1
- package/dist/cjs/HUDManagers/FileNetUtilityManager.js +25 -0
- package/dist/cjs/HUDManagers/FileTransferManager.js +3 -1
- package/dist/cjs/HUDManagers/FileUtilityManager.js +0 -1
- package/package.json +2 -1
package/dist/cjs/FileMessager.js
CHANGED
|
@@ -50,14 +50,15 @@ class FileMessager {
|
|
|
50
50
|
}
|
|
51
51
|
return client;
|
|
52
52
|
}
|
|
53
|
-
requestFromClient(
|
|
54
|
-
const
|
|
53
|
+
requestFromClient(requesterID, senderID, filePath = process.cwd(), destinationPath) {
|
|
54
|
+
const senderConnectionID = FileNetClientManager.getOnlineClient(senderID).id;
|
|
55
|
+
const client = this.getClientFromID(senderConnectionID);
|
|
55
56
|
if (!client) {
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
59
|
this.fileNet.emitToTide(client.tideID, "transfer-requested", {
|
|
59
60
|
senderID,
|
|
60
|
-
|
|
61
|
+
requesterID,
|
|
61
62
|
path: filePath,
|
|
62
63
|
destinationPath
|
|
63
64
|
});
|
|
@@ -107,12 +108,12 @@ class FileMessager {
|
|
|
107
108
|
}
|
|
108
109
|
handleRequestTransferFromClient(transferData) {
|
|
109
110
|
const {
|
|
111
|
+
requesterID,
|
|
110
112
|
senderID,
|
|
111
|
-
recipientId,
|
|
112
113
|
filePath,
|
|
113
114
|
destinationPath
|
|
114
115
|
} = transferData;
|
|
115
|
-
this.requestFromClient(
|
|
116
|
+
this.requestFromClient(requesterID, senderID, filePath, destinationPath);
|
|
116
117
|
}
|
|
117
118
|
handleClientToClientTransfer(transferData) {
|
|
118
119
|
const {
|
|
@@ -5,6 +5,11 @@ const {
|
|
|
5
5
|
} = require("@trap_stevo/iotide-client");
|
|
6
6
|
const chalk = require("chalk");
|
|
7
7
|
const path = require("path");
|
|
8
|
+
const {
|
|
9
|
+
FileNetUtilityManager,
|
|
10
|
+
significantMessageColors,
|
|
11
|
+
errorMessageColors
|
|
12
|
+
} = require("./HUDManagers/FileNetUtilityManager");
|
|
8
13
|
const {
|
|
9
14
|
FileMessagerConfigManager
|
|
10
15
|
} = require("./HUDManagers/FileMessagerConfigManager");
|
|
@@ -33,7 +38,7 @@ class FileMessagerClient {
|
|
|
33
38
|
transports: ["websocket"],
|
|
34
39
|
...options
|
|
35
40
|
});
|
|
36
|
-
|
|
41
|
+
FileNetUtilityManager.outputGradient(`\n[FileTide ~ File Messager] ~ Created client with ID ${clientID} and socket ${clientID}!`, significantMessageColors);
|
|
37
42
|
return clientID;
|
|
38
43
|
}
|
|
39
44
|
joinRoom(userID, roomName, options = {}) {
|
|
@@ -41,12 +46,21 @@ class FileMessagerClient {
|
|
|
41
46
|
url: this.clientOptions.url
|
|
42
47
|
}, options);
|
|
43
48
|
this.clientTide.joinChannel(socketName, roomName, userID, () => {
|
|
44
|
-
|
|
49
|
+
FileNetUtilityManager.outputGradient(`\n[FileTide ~ File Messager] ~ Client ~ ${userID} joined room ${roomName} successfully!`, significantMessageColors);
|
|
45
50
|
this.clients.set(userID, {
|
|
46
51
|
roomName
|
|
47
52
|
});
|
|
48
53
|
});
|
|
49
54
|
}
|
|
55
|
+
requestTransfer(clientID, senderID, filePath, destinationPath) {
|
|
56
|
+
this.clientTide.emitEvent(clientID, "request-transfer-from-client", {
|
|
57
|
+
requesterID: clientID,
|
|
58
|
+
senderID,
|
|
59
|
+
destinationPath,
|
|
60
|
+
filePath
|
|
61
|
+
});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
50
64
|
|
|
51
65
|
/**
|
|
52
66
|
* Sends all files in a directory in parallel using the sendFile method.
|
|
@@ -115,7 +129,6 @@ class FileMessagerClient {
|
|
|
115
129
|
});
|
|
116
130
|
},
|
|
117
131
|
onProgress: progress => {
|
|
118
|
-
//console.log(`\n[FileTide ~ File Messager] ~ ${progress.toFixed(2)}% |>>| ${fileName}`);
|
|
119
132
|
this.progressBarManager.updateTaskProgress(fileName, 512 * 1024);
|
|
120
133
|
},
|
|
121
134
|
originDetails: {
|
|
@@ -124,35 +137,48 @@ class FileMessagerClient {
|
|
|
124
137
|
},
|
|
125
138
|
fileDetails: {
|
|
126
139
|
name: fileName,
|
|
127
|
-
path: filePath
|
|
140
|
+
path: filePath,
|
|
141
|
+
size: fileSize
|
|
128
142
|
}
|
|
129
|
-
}).then(() =>
|
|
130
|
-
}
|
|
131
|
-
onFileChunkReceived(userID) {
|
|
132
|
-
this.clientTide.onEvent(userID, "transfer-progress", data => {
|
|
133
|
-
console.log(`\n[FileTide ~ File Messager] ~ Receiving file chunk for client ~ ${userID}: `, data.fileChunk);
|
|
134
|
-
console.log("\n[FileTide ~ File Messager] ~ Progress: ", data.progress);
|
|
135
|
-
FileUtilityManager.saveChunk(userID, data.fileChunk, data.path, data.name);
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
onFileTransferComplete(userID) {
|
|
139
|
-
this.clientTide.onEvent(userID, "transfer-complete", data => {
|
|
140
|
-
console.log(`\n[FileTide ~ File Messager] ~ File transfer completed for user ${userID}.`);
|
|
141
|
-
FileUtilityManager.assembleFile(userID);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
handleIncomingFile(userID) {
|
|
145
|
-
this.clientTide.onEvent(userID, "incoming-file", data => {
|
|
146
|
-
console.log(`\n[FileTide ~ File Messager] ~ Received file for user ${userID}: ${data.fileName}.`);
|
|
147
|
-
FileUtilityManager.saveFile(data.fileName, data.fileData, data.path, data.name);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
handleMultipleClientsTransfer() {
|
|
151
|
-
this.clients.forEach((userID, roomData) => {
|
|
152
|
-
this.onFileChunkReceived(userID);
|
|
153
|
-
this.onFileTransferComplete(userID);
|
|
154
|
-
});
|
|
143
|
+
}).then(() => FileNetUtilityManager.outputGradient(`[FileTide ~ File Messager] ~ File ~ ${fileName} transfer complete!`, significantMessageColors)).catch(error => FileNetUtilityManager.outputGradient(`Refused file transfer: ${error}`, errorMessageColors));
|
|
155
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
|
+
}*/
|
|
156
182
|
}
|
|
157
183
|
;
|
|
158
184
|
module.exports = FileMessagerClient;
|
package/dist/cjs/FileTide.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _FileTide;
|
|
3
4
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
4
5
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
5
6
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
6
7
|
const chalk = require("chalk");
|
|
7
8
|
const path = require("path");
|
|
8
9
|
const fs = require("fs");
|
|
10
|
+
const {
|
|
11
|
+
FileNetUtilityManager,
|
|
12
|
+
significantMessageColors,
|
|
13
|
+
errorMessageColors
|
|
14
|
+
} = require("./HUDManagers/FileNetUtilityManager.js");
|
|
9
15
|
const {
|
|
10
16
|
FileNetConfigManager
|
|
11
17
|
} = require("./HUDManagers/FileNetConfigManager.js");
|
|
@@ -28,6 +34,11 @@ class FileTide {
|
|
|
28
34
|
completionMessageColor: chalk.blue.bold
|
|
29
35
|
});
|
|
30
36
|
this.clients = new Map();
|
|
37
|
+
this.currentUserID = "";
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
static outputGradient(text, colors) {
|
|
41
|
+
FileNetUtilityManager.outputGradient(text, colors);
|
|
31
42
|
return;
|
|
32
43
|
}
|
|
33
44
|
|
|
@@ -39,7 +50,7 @@ class FileTide {
|
|
|
39
50
|
launchFileTide(serverOptions = {}, onLaunch) {
|
|
40
51
|
this.fileNet = new FileMessager(serverOptions);
|
|
41
52
|
this.fileNet.start();
|
|
42
|
-
|
|
53
|
+
FileTide.outputGradient("[FileTide] ~ FileNet launched successfully!", significantMessageColors);
|
|
43
54
|
if (onLaunch) {
|
|
44
55
|
onLaunch(this.fileNet);
|
|
45
56
|
}
|
|
@@ -60,9 +71,11 @@ class FileTide {
|
|
|
60
71
|
}
|
|
61
72
|
const newClient = new FileMessagerClient(clientOptions);
|
|
62
73
|
newClient.joinRoom(userID, roomName, connectionOptions);
|
|
63
|
-
|
|
74
|
+
|
|
75
|
+
//newClient.handleMultipleClientsTransfer();
|
|
76
|
+
|
|
64
77
|
this.clients.set(userID, newClient);
|
|
65
|
-
|
|
78
|
+
FileTide.outputGradient(`[FileTide] ~ Messager launched successfully for client ~ ${userID}!`, significantMessageColors);
|
|
66
79
|
_assertClassBrand(_FileTide_brand, this, _setupFileEventListeners).call(this, userID, newClient, onIncomingFile);
|
|
67
80
|
if (onLaunch) {
|
|
68
81
|
onLaunch(newClient);
|
|
@@ -83,69 +96,34 @@ class FileTide {
|
|
|
83
96
|
}
|
|
84
97
|
|
|
85
98
|
/**
|
|
86
|
-
* Send
|
|
87
|
-
* @param {String}
|
|
88
|
-
* @param {
|
|
89
|
-
* @param {
|
|
90
|
-
* @param {String} fileName - The name of the file
|
|
99
|
+
* Send files / directories directly to a device.
|
|
100
|
+
* @param {String} recipientID - The ID of the client device to send the data to
|
|
101
|
+
* @param {Buffer} fileData - The path of the data to send
|
|
102
|
+
* @param {String} destinationPath - The destination path on the device
|
|
91
103
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
fileChunk: chunkData,
|
|
113
|
-
totalChunks,
|
|
114
|
-
chunkIndex,
|
|
115
|
-
filePath
|
|
116
|
-
}, ack => {
|
|
117
|
-
if (ack.success) {
|
|
118
|
-
console.log(`Chunk ${chunkIndex} sent successfully!`);
|
|
119
|
-
resolve();
|
|
120
|
-
} else {
|
|
121
|
-
console.error(`Did not send chunk ${chunkIndex}`);
|
|
122
|
-
reject(new Error('Chunk failed.'));
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
onComplete: transferId => {
|
|
128
|
-
return new Promise((resolve, reject) => {
|
|
129
|
-
this.clientTide.emitEvent(senderID, "transfer-complete", {
|
|
130
|
-
recipientId: userID,
|
|
131
|
-
senderID,
|
|
132
|
-
fileName,
|
|
133
|
-
filePath
|
|
134
|
-
});
|
|
135
|
-
resolve();
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
onProgress: progress => {
|
|
139
|
-
console.log(`[FileTide ~ File Messager] ~ Progress: ${progress.toFixed(2)}%`);
|
|
140
|
-
},
|
|
141
|
-
fileDetails: {
|
|
142
|
-
name: fileName,
|
|
143
|
-
path: filePath
|
|
144
|
-
}
|
|
145
|
-
}).then(() => console.log("File transfer complete!")).catch(error => console.error("File transfer incomplete: ", error));
|
|
104
|
+
sendToDevice(recipientID, filePath, destinationPath) {
|
|
105
|
+
const fileDetails = this.getPathData(filePath);
|
|
106
|
+
const clientID = this.currentUserID;
|
|
107
|
+
const clientMessager = this.clients.get(clientID);
|
|
108
|
+
if (!clientMessager) {
|
|
109
|
+
FileTide.outputGradient(`[FileTide] Client ~ ${clientID} not found.`, ["#F94144", "#F3722C"]);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!fileDetails) {
|
|
113
|
+
FileTide.outputGradient(`[${clientID}] File at path ${filePath} not found.`, ["#F94144", "#F3722C"]);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (fileDetails.type === "file") {
|
|
117
|
+
FileTide.outputGradient(`[${clientID}] Sending file ~ ${fileDetails.content.fileName} to client ~ ${recipientID}...`, ["#00C897", "#00E0FF"]);
|
|
118
|
+
clientMessager.sendFile(clientID, recipientID, fileDetails.content.fileName, fileDetails.content.fileData, destinationPath, fileDetails.content.size);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (fileDetails.type === "directory") {
|
|
122
|
+
FileTide.outputGradient(`[${clientID}] Sending ${fileDetails.content.length} files in directory ~ ${path.basename(filePath)} to client ~ ${recipientID}...`, ["#00C897", "#00E0FF"]);
|
|
123
|
+
clientMessager.sendDirectoryFiles(clientID, recipientID, fileDetails.content, this.getTidePath(filePath), destinationPath);
|
|
146
124
|
return;
|
|
147
125
|
}
|
|
148
|
-
|
|
126
|
+
FileTide.outputGradient(`[FileTide] ~ No active client ~ ${recipientID} found.`, errorMessageColors);
|
|
149
127
|
return;
|
|
150
128
|
}
|
|
151
129
|
|
|
@@ -170,9 +148,9 @@ class FileTide {
|
|
|
170
148
|
*/
|
|
171
149
|
stopFileTide() {
|
|
172
150
|
if (this.fileNet) {
|
|
173
|
-
|
|
151
|
+
FileTide.outputGradient("Stopping FileTide...", significantMessageColors);
|
|
174
152
|
this.fileNet = null;
|
|
175
|
-
|
|
153
|
+
FileTide.outputGradient("Stopped FileTide.", significantMessageColors);
|
|
176
154
|
}
|
|
177
155
|
return;
|
|
178
156
|
}
|
|
@@ -183,12 +161,12 @@ class FileTide {
|
|
|
183
161
|
*/
|
|
184
162
|
stopMessager(userID) {
|
|
185
163
|
if (this.clients.has(userID)) {
|
|
186
|
-
|
|
164
|
+
FileTide.outputGradient(`Stopping messager for user ${userID}...`, significantMessageColors);
|
|
187
165
|
this.clients.delete(userID);
|
|
188
|
-
|
|
166
|
+
FileTide.outputGradient(`Stopped messager for user ${userID}.`, significantMessageColors);
|
|
189
167
|
return;
|
|
190
168
|
}
|
|
191
|
-
|
|
169
|
+
FileTide.outputGradient(`No active messager found for user ${userID}.`, errorMessageColors);
|
|
192
170
|
return;
|
|
193
171
|
}
|
|
194
172
|
|
|
@@ -196,12 +174,13 @@ class FileTide {
|
|
|
196
174
|
* Stop all active clients.
|
|
197
175
|
*/
|
|
198
176
|
stopAllMessagers() {
|
|
199
|
-
|
|
177
|
+
FileTide.outputGradient("Stopping all messagers...", significantMessageColors);
|
|
200
178
|
this.clients.clear();
|
|
201
|
-
|
|
179
|
+
FileTide.outputGradient("All messagers stopped.", significantMessageColors);
|
|
202
180
|
return;
|
|
203
181
|
}
|
|
204
182
|
}
|
|
183
|
+
_FileTide = FileTide;
|
|
205
184
|
function _setupFileEventListeners(userID, client, onIncomingFile) {
|
|
206
185
|
const cliTable = new ConsoleTable({
|
|
207
186
|
padding: 2,
|
|
@@ -245,7 +224,7 @@ function _setupFileEventListeners(userID, client, onIncomingFile) {
|
|
|
245
224
|
console.log(`\n[FileTide ~ FileNet]\n\n`, cliTable.render(), "\n");
|
|
246
225
|
});
|
|
247
226
|
client.clientTide.onEvent(userID, "incoming-transfer", data => {
|
|
248
|
-
|
|
227
|
+
_FileTide.outputGradient(`[${userID}] Preparing to receive transfer : ${FileUtilityManager.getTidePath(data.path)}`, significantMessageColors);
|
|
249
228
|
this.progressBarManager.completionMessage = `Successfully received transfer from ${recipientId}!`;
|
|
250
229
|
this.progressBarManager.displayPage("Page Number:", "Press 'n' for next page, 'p' for previous page.", chalk.blue, chalk.magenta);
|
|
251
230
|
this.progressBarManager.listenForInput("Page Number:", "Press 'n' for next page, 'p' for previous page.", chalk.blue, chalk.magenta, chalk.yellow);
|
|
@@ -266,7 +245,7 @@ function _setupFileEventListeners(userID, client, onIncomingFile) {
|
|
|
266
245
|
fs.mkdirSync(saveDir, {
|
|
267
246
|
recursive: true
|
|
268
247
|
});
|
|
269
|
-
|
|
248
|
+
_FileTide.outputGradient(`[${userID}] Created directory : ${saveDir}`, significantMessageColors);
|
|
270
249
|
}
|
|
271
250
|
});
|
|
272
251
|
client.clientTide.onEvent(userID, "transfer-progress", data => {
|
|
@@ -299,12 +278,14 @@ function _setupFileEventListeners(userID, client, onIncomingFile) {
|
|
|
299
278
|
const savePath = FileUtilityManager.getTidePath(path.join(data.filePath, data.fileName));
|
|
300
279
|
const fullFile = Buffer.concat(transferState.receivedChunks);
|
|
301
280
|
fs.writeFileSync(savePath, fullFile);
|
|
302
|
-
|
|
281
|
+
_FileTide.outputGradient(`[${userID}] File saved at : ${savePath}`, significantMessageColors);
|
|
303
282
|
activeTransfers.delete(data.fileName);
|
|
304
283
|
});
|
|
305
|
-
client.clientTide.onEvent(userID, "transfer-
|
|
306
|
-
|
|
284
|
+
client.clientTide.onEvent(userID, "transfer-requested", data => {
|
|
285
|
+
_FileTide.outputGradient(`[${userID}] Transfer requested from: ${data.requesterID}`, significantMessageColors);
|
|
286
|
+
this.sendToDevice(data.requesterID, data.path, data.destinationPath);
|
|
307
287
|
});
|
|
288
|
+
this.currentUserID = userID;
|
|
308
289
|
return;
|
|
309
290
|
}
|
|
310
291
|
;
|
|
@@ -251,7 +251,7 @@ class ConsoleProgressBarManager {
|
|
|
251
251
|
exitInputListener() {
|
|
252
252
|
process.stdin.removeListener("data", this.inputListener);
|
|
253
253
|
process.stdin.setRawMode(false);
|
|
254
|
-
process.stdin.
|
|
254
|
+
process.stdin.resume();
|
|
255
255
|
}
|
|
256
256
|
displayCompletionMessage() {
|
|
257
257
|
const lastLine = Math.min(this.taskBars.length, this.barsPerPage);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
HUDUtilityManager
|
|
5
|
+
} = require("@trap_stevo/legendarybuilderpronodejs-utilities");
|
|
6
|
+
const chalk = require("chalk");
|
|
7
|
+
const significantMessageColors = ["#00C897", "#00E0FF"];
|
|
8
|
+
const errorMessageColors = ["#F94144", "#F3722C"];
|
|
9
|
+
class FileNetUtilityManager {
|
|
10
|
+
static outputGradient(text, colors) {
|
|
11
|
+
const gradient = HUDUtilityManager.generateGradientColors(colors, text.length);
|
|
12
|
+
let coloredText = "";
|
|
13
|
+
for (let i = 0; i < text.length; i++) {
|
|
14
|
+
const [r, g, b] = gradient[i];
|
|
15
|
+
coloredText += chalk.rgb(r, g, b)(text[i]);
|
|
16
|
+
}
|
|
17
|
+
console.log(coloredText);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
module.exports = {
|
|
22
|
+
FileNetUtilityManager,
|
|
23
|
+
significantMessageColors,
|
|
24
|
+
errorMessageColors
|
|
25
|
+
};
|
|
@@ -35,7 +35,8 @@ function _startTransfer(file, transferId, fileDetails, onSendChunk, onComplete,
|
|
|
35
35
|
completedChunks: 0,
|
|
36
36
|
activeChunks: 0,
|
|
37
37
|
failedChunks: new Map(),
|
|
38
|
-
currentChunk: 0
|
|
38
|
+
currentChunk: 0,
|
|
39
|
+
size: fileDetails.size
|
|
39
40
|
});
|
|
40
41
|
const updateProgress = () => {
|
|
41
42
|
const transferState = this.activeTransfers.get(transferId);
|
|
@@ -54,6 +55,7 @@ function _startTransfer(file, transferId, fileDetails, onSendChunk, onComplete,
|
|
|
54
55
|
onStart({
|
|
55
56
|
name: fileDetails.name,
|
|
56
57
|
path: fileDetails.path,
|
|
58
|
+
size: fileDetails.size,
|
|
57
59
|
totalChunks: transferState.totalChunks
|
|
58
60
|
});
|
|
59
61
|
}
|
|
@@ -41,7 +41,6 @@ class FileUtilityManager {
|
|
|
41
41
|
">Temp": platform === "win32" ? path.join("C:", "Windows", "Temp") : "/tmp",
|
|
42
42
|
">LogFiles": platform === "win32" ? path.join("C:", "Windows", "Logs") : "/var/log",
|
|
43
43
|
">SystemRoot": platform === "win32" ? path.join("C:", "Windows") : "/",
|
|
44
|
-
">Downloads": path.join(homeDir, "Downloads"),
|
|
45
44
|
">Cache": platform === "win32" ? path.join(homeDir, "AppData", "Local", "Cache") : path.join(homeDir, ".cache"),
|
|
46
45
|
">Config": platform === "win32" ? path.join(homeDir, "AppData", "Local", "Config") : "/etc",
|
|
47
46
|
">CurrentDirectory": process.cwd(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
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": {
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@trap_stevo/iotide": "^0.0.36",
|
|
33
33
|
"@trap_stevo/iotide-client": "^0.0.15",
|
|
34
|
+
"@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.40",
|
|
34
35
|
"chalk": "^4.1.2",
|
|
35
36
|
"readline": "^1.3.0"
|
|
36
37
|
},
|