roxify 1.3.1 → 1.3.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.
package/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ import { basename, dirname, join, resolve } from 'path';
6
6
  import { DataFormatError, decodePngToBinary, encodeBinaryToPng, hasPassphraseInPng, IncorrectPassphraseError, listFilesInPng, PassphraseRequiredError, } from './index.js';
7
7
  import { packPathsGenerator, unpackBuffer } from './pack.js';
8
8
  import { encodeWithRustCLI, isRustBinaryAvailable, } from './utils/rust-cli-wrapper.js';
9
- const VERSION = '1.3.1';
9
+ const VERSION = '1.3.2';
10
10
  async function readLargeFile(filePath) {
11
11
  const st = statSync(filePath);
12
12
  if (st.size <= 2 * 1024 * 1024 * 1024) {
@@ -5,16 +5,52 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = dirname(__filename);
7
7
  function findRustBinary() {
8
- const possiblePaths = [
9
- join(__dirname, '..', '..', 'target', 'release', 'roxify_native'),
10
- join(__dirname, '..', 'dist', 'roxify-cli'),
11
- '/usr/local/bin/roxify_native',
8
+ const candidates = [];
9
+ const binNames = process.platform === 'win32'
10
+ ? ['roxify-cli.exe', 'roxify_cli.exe', 'roxify_native.exe']
11
+ : ['roxify-cli', 'roxify_cli', 'roxify_native'];
12
+ // Possible locations relative to this file (works in repo and in packaged dist)
13
+ const relativeDirs = [
14
+ join(__dirname, '..', '..', 'target', 'release'),
15
+ join(__dirname, '..', '..', 'dist'),
16
+ join(__dirname, '..'),
17
+ join(__dirname, '..', '..'),
12
18
  ];
13
- for (const path of possiblePaths) {
14
- if (existsSync(path)) {
15
- return path;
19
+ for (const dir of relativeDirs) {
20
+ for (const name of binNames) {
21
+ candidates.push(join(dir, name));
16
22
  }
17
23
  }
24
+ // Common global paths
25
+ if (process.platform !== 'win32') {
26
+ candidates.push('/usr/local/bin/roxify_native');
27
+ candidates.push('/usr/bin/roxify_native');
28
+ }
29
+ for (const p of candidates) {
30
+ try {
31
+ if (existsSync(p))
32
+ return p;
33
+ }
34
+ catch (e) { }
35
+ }
36
+ // Search in PATH for common binary names
37
+ try {
38
+ const which = process.platform === 'win32' ? 'where' : 'which';
39
+ const { execSync } = require('child_process');
40
+ for (const name of binNames) {
41
+ try {
42
+ const out = execSync(`${which} ${name}`, { encoding: 'utf-8' })
43
+ .split('\n')[0]
44
+ .trim();
45
+ if (out && existsSync(out))
46
+ return out;
47
+ }
48
+ catch (e) {
49
+ // ignore
50
+ }
51
+ }
52
+ }
53
+ catch (e) { }
18
54
  return null;
19
55
  }
20
56
  export function isRustBinaryAvailable() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roxify",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Encode binary data into PNG images and decode them back. CLI and programmatic API with native Rust acceleration.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",