app download + building script

This commit is contained in:
2021-03-19 19:08:17 +01:00
parent 45b9d2cf19
commit 6fb5fbc708
4 changed files with 110 additions and 1 deletions

14
download.js Normal file
View File

@@ -0,0 +1,14 @@
const axios = require('axios').default;
const unzip = require('unzip-stream');
const fs = require('fs');
const download = require('download');
axios.get('https://git.odit.services/api/v1/repos/lfk/scanclient/releases').then(({ data }) => {
(async () => {
const download_file = data[0].assets.find((a) => a.name === 'dist.zip').browser_download_url;
fs.writeFileSync('app.zip', await download(download_file));
fs.createReadStream('app.zip').pipe(unzip.Parse()).on('entry', () => {
fs.createReadStream('app.zip').pipe(unzip.Extract({ path: './appcode/' }));
});
})();
});