nodio-cli 1.0.0

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,36 @@
1
+ #!/usr/bin/env node
2
+ const { Command } = require('commander');
3
+ const { uploadFile, downloadFile } = require('./commands');
4
+
5
+ const program = new Command();
6
+
7
+ program.name('nodio').description('Nodio user CLI');
8
+
9
+ program
10
+ .command('upload')
11
+ .description('Encrypt, shard, and distribute a file across donor nodes')
12
+ .requiredOption('--file <path>', 'path to local file')
13
+ .option('--server <url>', 'central server URL', 'http://127.0.0.1:4000')
14
+ .option('--file-id <id>', 'custom file ID (optional)')
15
+ .option('--shard-size-mb <mb>', 'plaintext shard size in MB', '1')
16
+ .option('--replicas <count>', 'replicas per shard (minimum 5)', '5')
17
+ .option('--key-base64 <key>', '32-byte AES key in base64 (optional)')
18
+ .action(async (options) => {
19
+ await uploadFile(options);
20
+ });
21
+
22
+ program
23
+ .command('download')
24
+ .description('Download, verify, decrypt, and reconstruct a file')
25
+ .requiredOption('--file-id <id>', 'file ID to download')
26
+ .requiredOption('--key-base64 <key>', '32-byte AES key in base64 from upload output')
27
+ .option('--server <url>', 'central server URL', 'http://127.0.0.1:4000')
28
+ .option('--output <path>', 'output file path')
29
+ .action(async (options) => {
30
+ await downloadFile(options);
31
+ });
32
+
33
+ program.parseAsync(process.argv).catch((error) => {
34
+ console.error('[nodio]', error.message);
35
+ process.exit(1);
36
+ });