scanclient-electron/download.js

15 lines
584 B
JavaScript

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/' }));
});
})();
});