Socket
Socket
Sign inDemoInstall

altv-pkg

Package Overview
Dependencies
8
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

35

bin/altv-pkg.js

@@ -43,15 +43,23 @@ #!/usr/bin/env node

const binaryDownload = platform === 'x64_linux' ? `https://cdn.altv.mp/server/${branch}/x64_linux/altv-server` : `https://cdn.altv.mp/server/${branch}/x64_win32/altv-server.exe`;
const linuxFiles = {
'data/vehmodels.bin': `https://cdn.altv.mp/data/${branch}/data/vehmodels.bin`,
'data/vehmods.bin': `https://cdn.altv.mp/data/${branch}/data/vehmods.bin`,
'data/clothes.bin': `https://cdn.altv.mp/data/${branch}/data/clothes.bin`,
'modules/libjs-module.so': `https://cdn.altv.mp/js-module/${branch}/${platform}/modules/js-module/libjs-module.so`,
'libnode.so.83': `https://cdn.altv.mp/js-module/${branch}/${platform}/modules/js-module/libnode.so.83`,
'start.sh': `https://cdn.altv.mp/others/start.sh`,
'altv-server': `https://cdn.altv.mp/server/${branch}/x64_linux/altv-server`,
}
const altvFiles = {
// alt:V data files
const windowsFiles = {
'data/vehmodels.bin': `https://cdn.altv.mp/data/${branch}/data/vehmodels.bin`,
'data/vehmods.bin': `https://cdn.altv.mp/data/${branch}/data/vehmods.bin`,
'data/clothes.bin': `https://cdn.altv.mp/data/${branch}/data/clothes.bin`,
// alt:V modules
'modules/js-module.dll': `https://cdn.altv.mp/js-module/${branch}/${platform}/modules/js-module/js-module.dll`,
'libnode.dll': `https://cdn.altv.mp/js-module/${branch}/${platform}/modules/js-module/libnode.dll`,
'altv-server.exe': `https://cdn.altv.mp/server/${branch}/${platform}/altv-server.exe`,
};
const filesToUse = platform == 'x64_win32' ? windowsFiles : linuxFiles;
if (!fs.existsSync(path.join(rootPath, 'data'))) {

@@ -67,3 +75,3 @@ fs.mkdirSync(path.join(rootPath, 'data'));

console.log(chalk.greenBright('===== Download ====='));
for (const [file, url] of Object.entries(altvFiles)) {
for (const [file, url] of Object.entries(filesToUse)) {
console.log(chalk.whiteBright(`${file}`))

@@ -83,17 +91,2 @@ const promise = new Promise((resolve) => {

const binaryPathing = binaryDownload.split('/');
const binaryFileName = binaryPathing[binaryPathing.length - 1];
const promise = new Promise((resolve) => {
axios.get(binaryDownload, { responseType: 'arraybuffer' }).then(response => {
console.log(chalk.whiteBright(`${binaryFileName}`))
fs.writeFileSync(path.join(rootPath, binaryFileName), response.data);
resolve();
}).catch(error => {
console.error(`Failed to download ${binaryFileName}: ${error}`);
resolve();
})
});
promises.push(promise);
await Promise.all(promises);

@@ -100,0 +93,0 @@ console.log(chalk.greenBright('===== Complete ====='));

2

package.json
{
"name": "altv-pkg",
"version": "2.0.1",
"version": "2.0.2",
"description": "Install alt:V Binaries Quickly",

@@ -5,0 +5,0 @@ "main": "bin/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc