@trap_stevo/filetide 0.0.18 → 0.0.19
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.
|
@@ -53,16 +53,15 @@ class FileMessagerClient {
|
|
|
53
53
|
*/
|
|
54
54
|
sendDirectoryFiles(clientID, recipientId, filesData, baseDirectory, destinationPath) {
|
|
55
55
|
const baseDirectoryName = path.basename(baseDirectory);
|
|
56
|
-
const adjustedDestinationPath = path.join(destinationPath, baseDirectoryName);
|
|
56
|
+
const adjustedDestinationPath = FileUtilityManager.normalizePath(path.join(destinationPath, baseDirectoryName));
|
|
57
57
|
const sendFilePromises = filesData.map(fileInfo => {
|
|
58
58
|
const relativeFilePath = path.dirname(path.relative(baseDirectory, fileInfo.filePath));
|
|
59
|
-
const fileDestinationPath = path.join(adjustedDestinationPath, relativeFilePath);
|
|
59
|
+
const fileDestinationPath = FileUtilityManager.normalizePath(path.join(adjustedDestinationPath, relativeFilePath));
|
|
60
60
|
return this.sendFile(clientID, recipientId, fileInfo.fileName, fileInfo.fileData, fileDestinationPath);
|
|
61
61
|
});
|
|
62
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
|
-
console.log(fileName, ": ", file);
|
|
66
65
|
if (!file) {
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
@@ -94,13 +93,13 @@ class FileMessagerClient {
|
|
|
94
93
|
});
|
|
95
94
|
},
|
|
96
95
|
onProgress: progress => {
|
|
97
|
-
console.log(`\n[FileTide ~ File Messager] ~
|
|
96
|
+
console.log(`\n[FileTide ~ File Messager] ~ ${progress.toFixed(2)}% |>>| ${fileName}`);
|
|
98
97
|
},
|
|
99
98
|
fileDetails: {
|
|
100
99
|
name: fileName,
|
|
101
100
|
path: filePath
|
|
102
101
|
}
|
|
103
|
-
}).then(() => console.log(
|
|
102
|
+
}).then(() => console.log(`[FileTide ~ File Messager] ~ File ~ ${fileName} transfer complete!`)).catch(error => console.error('File transfer failed:', error));
|
|
104
103
|
}
|
|
105
104
|
onFileChunkReceived(userID) {
|
|
106
105
|
this.clientTide.onEvent(userID, "transfer-progress", data => {
|
package/dist/cjs/FileTide.js
CHANGED
|
@@ -95,13 +95,6 @@ class FileTide {
|
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
console.log(`[FileTide] ~ Sending file to client ~ ${userID}...`);
|
|
98
|
-
console.log({
|
|
99
|
-
recipientId: userID,
|
|
100
|
-
senderID,
|
|
101
|
-
fileName,
|
|
102
|
-
filePath,
|
|
103
|
-
fileData
|
|
104
|
-
});
|
|
105
98
|
this.fileNet.transporter.sendFile(fileData, {
|
|
106
99
|
onSendChunk: (transferId, chunkIndex, chunkData, totalChunks) => {
|
|
107
100
|
return new Promise((resolve, reject) => {
|
|
@@ -48,7 +48,7 @@ class FileUtilityManager {
|
|
|
48
48
|
function readDirectory(currentPath) {
|
|
49
49
|
const fileList = fs.readdirSync(currentPath);
|
|
50
50
|
fileList.forEach(file => {
|
|
51
|
-
const filePath = path.join(currentPath, file);
|
|
51
|
+
const filePath = FileUtilityManager.normalizePath(path.join(currentPath, file));
|
|
52
52
|
const stats = fs.statSync(filePath);
|
|
53
53
|
if (stats.isFile()) {
|
|
54
54
|
const fileData = FileUtilityManager.getFileData(filePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
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": {
|