@paimaexample/npm-avail-light-client 0.3.122 → 0.3.123
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/binary.js +12 -3
- package/package.json +1 -1
package/binary.js
CHANGED
|
@@ -54,6 +54,17 @@ const getBinaryPath = () => {
|
|
|
54
54
|
return path.join(__dirname, "bin", exeName);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
const ensureExecutable = (binaryPath) => {
|
|
58
|
+
if (!fs.existsSync(binaryPath)) {
|
|
59
|
+
throw new Error(`Binary not found at path: ${binaryPath}`);
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.warn(`Failed to chmod ${binaryPath}: ${error.message}`);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
57
68
|
const downloadBinary = async () => {
|
|
58
69
|
const binaryLink = getBinaryLink();
|
|
59
70
|
const key = getBinaryKey();
|
|
@@ -137,9 +148,7 @@ const downloadBinary = async () => {
|
|
|
137
148
|
throw new Error(`Binary not found at expected path: ${binaryPath}`);
|
|
138
149
|
}
|
|
139
150
|
|
|
140
|
-
|
|
141
|
-
fs.chmodSync(binaryPath, "755");
|
|
142
|
-
}
|
|
151
|
+
ensureExecutable(binaryPath);
|
|
143
152
|
|
|
144
153
|
console.log("Binary ready at:", binaryPath);
|
|
145
154
|
return binaryPath;
|