roxify 1.6.7 → 1.6.9
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/cli.js
CHANGED
|
@@ -80,6 +80,23 @@ Options:
|
|
|
80
80
|
--debug Export debug images (doubled.png, reconstructed.png)
|
|
81
81
|
-v, --verbose Show detailed errors
|
|
82
82
|
|
|
83
|
+
Lossy-Resilient Encoding:
|
|
84
|
+
--lossy-resilient Enable lossy-resilient mode (survives JPEG/MP3)
|
|
85
|
+
--ecc-level <level> ECC redundancy: low|medium|quartile|high (default: medium)
|
|
86
|
+
--block-size <n> Robust image block size: 2-8 pixels (default: 4)
|
|
87
|
+
|
|
88
|
+
When --lossy-resilient is active, data is encoded with Reed-Solomon ECC
|
|
89
|
+
and rendered as a QR-code-style grid (image) or MFSK tones (audio).
|
|
90
|
+
Use --sound or --image to choose the container format.
|
|
91
|
+
|
|
92
|
+
Examples:
|
|
93
|
+
npx rox encode secret.pdf Encode to PNG
|
|
94
|
+
npx rox encode secret.pdf --sound Encode to WAV
|
|
95
|
+
npx rox encode secret.pdf --lossy-resilient Lossy-resilient PNG
|
|
96
|
+
npx rox encode secret.pdf --lossy-resilient --sound --ecc-level high
|
|
97
|
+
npx rox decode secret.pdf.png Decode back
|
|
98
|
+
npx rox decode secret.pdf.wav Decode WAV back
|
|
99
|
+
|
|
83
100
|
Run "npx rox help" for this message.
|
|
84
101
|
`);
|
|
85
102
|
}
|
|
@@ -118,6 +135,28 @@ function parseArgs(args) {
|
|
|
118
135
|
parsed.forceTs = true;
|
|
119
136
|
i++;
|
|
120
137
|
}
|
|
138
|
+
else if (key === 'lossy-resilient') {
|
|
139
|
+
parsed.lossyResilient = true;
|
|
140
|
+
i++;
|
|
141
|
+
}
|
|
142
|
+
else if (key === 'ecc-level') {
|
|
143
|
+
const lvl = args[i + 1];
|
|
144
|
+
if (!['low', 'medium', 'quartile', 'high'].includes(lvl)) {
|
|
145
|
+
console.error(`Invalid --ecc-level: ${lvl}. Must be low|medium|quartile|high`);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
parsed.eccLevel = lvl;
|
|
149
|
+
i += 2;
|
|
150
|
+
}
|
|
151
|
+
else if (key === 'block-size') {
|
|
152
|
+
const bs = parseInt(args[i + 1], 10);
|
|
153
|
+
if (isNaN(bs) || bs < 2 || bs > 8) {
|
|
154
|
+
console.error(`Invalid --block-size: ${args[i + 1]}. Must be 2-8`);
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
parsed.blockSize = bs;
|
|
158
|
+
i += 2;
|
|
159
|
+
}
|
|
121
160
|
else if (key === 'sound') {
|
|
122
161
|
parsed.container = 'sound';
|
|
123
162
|
i++;
|
|
@@ -360,6 +399,13 @@ async function encodeCommand(args) {
|
|
|
360
399
|
options.passphrase = parsed.passphrase;
|
|
361
400
|
options.encrypt = parsed.encrypt || 'aes';
|
|
362
401
|
}
|
|
402
|
+
if (parsed.lossyResilient) {
|
|
403
|
+
options.lossyResilient = true;
|
|
404
|
+
if (parsed.eccLevel)
|
|
405
|
+
options.eccLevel = parsed.eccLevel;
|
|
406
|
+
if (parsed.blockSize)
|
|
407
|
+
options.robustBlockSize = parsed.blockSize;
|
|
408
|
+
}
|
|
363
409
|
console.log(`Encoding to ${resolvedOutput} (Mode: ${mode}, Container: ${containerMode === 'sound' ? 'WAV' : 'PNG'})\n`);
|
|
364
410
|
let inputData;
|
|
365
411
|
let inputSizeVal = 0;
|
package/dist/utils/native.js
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { existsSync } from 'fs';
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { arch, platform } from 'os';
|
|
4
|
-
import { join, resolve } from 'path';
|
|
4
|
+
import { dirname, join, resolve } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
5
6
|
function getNativeModule() {
|
|
6
7
|
let moduleDir;
|
|
7
8
|
let nativeRequire;
|
|
9
|
+
// In ESM, __dirname is not available — derive it from import.meta.url
|
|
10
|
+
// which always points to the actual file location on disk.
|
|
11
|
+
const esmFilename = fileURLToPath(import.meta.url);
|
|
12
|
+
const esmDirname = dirname(esmFilename);
|
|
8
13
|
if (typeof __dirname !== 'undefined') {
|
|
9
14
|
moduleDir = __dirname;
|
|
10
15
|
nativeRequire = require;
|
|
11
16
|
}
|
|
12
17
|
else {
|
|
13
|
-
moduleDir =
|
|
18
|
+
moduleDir = esmDirname;
|
|
14
19
|
try {
|
|
15
20
|
nativeRequire = require;
|
|
16
21
|
}
|
|
17
22
|
catch {
|
|
18
|
-
nativeRequire = createRequire(
|
|
23
|
+
nativeRequire = createRequire(esmFilename);
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
function getNativePath() {
|
package/package.json
CHANGED
|
Binary file
|
package/roxify_native.node
CHANGED
|
Binary file
|