@trap_stevo/filenet 0.0.0 → 0.0.2

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.
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const FileTide = require("@trap_stevo/filetide");
5
+ const fs = require("fs");
6
+ const args = process.argv.slice(2);
7
+ const flags = args.filter(arg => arg.startsWith("--"));
8
+ const positionalArgs = args.filter(arg => !arg.startsWith("--"));
9
+ const noMessager = flags.includes("--no-messager");
10
+ const configFilePath = positionalArgs[6] || null;
11
+ let config = {};
12
+ if (configFilePath) {
13
+ try {
14
+ const fileData = fs.readFileSync(configFilePath, "utf-8");
15
+ config = JSON.parse(fileData);
16
+ } catch (error) {
17
+ console.error("Did not read or parse config file: ", error.message);
18
+ process.exit(1);
19
+ }
20
+ }
21
+ const port = positionalArgs[0] || config.port || 8869;
22
+ const serverUrl = positionalArgs[1] || config.serverUrl || `http://localhost:${port}`;
23
+ const room = positionalArgs[2] || config.room || "file-room";
24
+ const clientID = positionalArgs[3] || config.clientID || "FileNetServer";
25
+ const options = {
26
+ port: port,
27
+ ...config.options,
28
+ ...JSON.parse(positionalArgs[4] || "{}")
29
+ };
30
+ const messagerOptions = {
31
+ maxHttpBufferSize: 5e9,
32
+ pingTimeout: 60000,
33
+ pingInterval: 25000,
34
+ ...config.messagerOptions,
35
+ ...JSON.parse(positionalArgs[5] || "{}")
36
+ };
37
+ const fileT = new FileTide();
38
+ fileT.launchFileTide(options, fileNet => {
39
+ console.log("[FileTide] ~ FileNet launched successfully!");
40
+ if (!noMessager) {
41
+ fileT.launchMessager({
42
+ serverUrl: serverUrl
43
+ }, messagerOptions, room, clientID, fileMessager => {
44
+ fileMessager.clientTide.onEvent(clientID, "connect", () => {
45
+ console.log(`[${clientID}] Connected to FileTide ~ ${serverUrl} in ${room}!`);
46
+ fileMessager.clientTide.emitEvent(clientID, "client-online", clientID, fileMessager.clientTide.sockets[clientID].tideID, "", fileMessager.clientTide.sockets[clientID].id);
47
+ });
48
+ fileMessager.clientTide.onEvent(clientID, "disconnect", () => {
49
+ fileMessager.clientTide.emitEvent(clientID, "client-offline", clientID);
50
+ console.log(`[${clientID}] Disconnected from the file net.`);
51
+ });
52
+ });
53
+ }
54
+ });
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,35 @@
1
1
  "use strict";
2
2
 
3
- const FileTide = require('@trap_stevo/filetide');
4
- const fileTide = new FileTide();
5
- fileTide.launchFileTide({
6
- port: 9269
7
- });
8
- console.log('[Server] Waiting for client connections...');
3
+ const FileTide = require("@trap_stevo/filetide");
4
+ class FileNet {
5
+ constructor() {
6
+ this.fileNetManager = new FileTide();
7
+ return;
8
+ }
9
+ launch(netOptions = {}, onLaunch) {
10
+ this.fileNetManager.launchFileTide(netOptions, onLaunch);
11
+ return;
12
+ }
13
+ getDirectoryData(directoryPath) {
14
+ return this.fileNetManager.getDirectoryData(directoryPath);
15
+ }
16
+ getFileData(filePath) {
17
+ return this.fileNetManager.getFileData(filePath);
18
+ }
19
+ getPathData(inputPath) {
20
+ return this.fileNetManager.getPathData(inputPath);
21
+ }
22
+ sendFileToDevice(senderID, userID, fileData, filePath, fileName) {
23
+ this.fileNetManager.sendFileToDevice(senderID, userID, fileData, filePath, fileName);
24
+ return;
25
+ }
26
+ operational() {
27
+ return this.fileNetManager.fileTideOperational();
28
+ }
29
+ close() {
30
+ this.fileNetManager.stopFileTide();
31
+ return;
32
+ }
33
+ }
34
+ ;
35
+ module.exports = FileNet;
package/package.json CHANGED
@@ -1,29 +1,50 @@
1
- {
2
- "name": "@trap_stevo/filenet",
3
- "version": "0.0.0",
4
- "description": "A groundbreaking OTA (Over-The-Air) logging system that seamlessly connects and communicates logs across any application. Transform the way you monitor and manage data with a tool that redefines real-time logging, putting unmatched power and precision at your fingertips.",
5
- "main": "dist/cjs/index.js",
6
- "scripts": {
7
- "build": "babel src -d dist/cjs --env-name cjs",
8
- "start": "node dist/cjs/index.js"
9
- },
10
- "keywords": [
11
- "real-time",
12
- "nodejs",
13
- "ota",
14
- "over-the-air",
15
- "file communication"
16
- ],
17
- "author": "Steven Compton",
18
- "license": "ISC",
19
- "dependencies": {
20
- "@trap_stevo/filetide": "^0.0.1"
21
- },
22
- "devDependencies": {
23
- "@babel/cli": "^7.24.8",
24
- "@babel/core": "^7.25.2",
25
- "@babel/plugin-proposal-class-properties": "^7.18.6",
26
- "@babel/plugin-transform-runtime": "^7.24.7",
27
- "@babel/preset-env": "^7.25.3"
28
- }
29
- }
1
+ {
2
+ "name": "@trap_stevo/filenet",
3
+ "version": "0.0.2",
4
+ "description": "Provides the groundbreaking solution for real-time, OTA (Over-The-Air) file transfer, streamlining client-to-client sharing with unmatched efficiency and effortless, on-the-fly handling. Whether managing peer-to-peer or client-server transfers, FileNet ensures seamless communication across devices, allowing for file transfers from all over the world, while maintaining fast, secure, and dynamic connectivity. Along with proprietary maximum performance measures, it delivers parallelly synchronized, high-speed transfers, from large data exchanges to instant sharing, setting a new standard in modern file transfer and redefining real-time connectivity.",
5
+ "main": "./dist/cjs/index.js",
6
+ "exports": {
7
+ ".": "dist/cjs/index.js"
8
+ },
9
+ "bin": {
10
+ "filenet": "./dist/cjs/filenet.js"
11
+ },
12
+ "scripts": {
13
+ "build": "babel src -d dist/cjs --env-name cjs",
14
+ "start": "node dist/cjs/index.js"
15
+ },
16
+ "keywords": [
17
+ "Legendary",
18
+ "Enlightened",
19
+ "Steven Compton",
20
+ "Magical",
21
+ "real-time",
22
+ "nodejs",
23
+ "ota",
24
+ "over-the-air",
25
+ "file communication",
26
+ "file transfer",
27
+ "device-to-device",
28
+ "cross-platform",
29
+ "instant messaging",
30
+ "file sharing",
31
+ "client-server",
32
+ "peer-to-peer",
33
+ "P2P",
34
+ "network transfer",
35
+ "data transfer",
36
+ "seamless connectivity"
37
+ ],
38
+ "author": "Steven Compton",
39
+ "license": "ISC",
40
+ "dependencies": {
41
+ "@trap_stevo/filetide": "^0.0.19"
42
+ },
43
+ "devDependencies": {
44
+ "@babel/cli": "^7.24.8",
45
+ "@babel/core": "^7.25.2",
46
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
47
+ "@babel/plugin-transform-runtime": "^7.24.7",
48
+ "@babel/preset-env": "^7.25.3"
49
+ }
50
+ }
package/test.txt DELETED
@@ -1 +0,0 @@
1
- oiyutryuihoj