First commit of the new Insider version on docker
This commit is contained in:
20
models/updateHelper.js
Normal file
20
models/updateHelper.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const fs = require('fs');
|
||||
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
|
||||
const AdmZip = require('adm-zip');
|
||||
const { logger, ErrorLogger, logRequestInfo } = require('../config/logs');
|
||||
|
||||
function compareAndUpdate(currentPath, updatedPath) {
|
||||
}
|
||||
|
||||
async function downloadUpdate(updateUrl, destinationPath) {
|
||||
const response = await fetch(updateUrl);
|
||||
const buffer = await response.buffer();
|
||||
fs.writeFileSync(destinationPath, buffer);
|
||||
}
|
||||
|
||||
function unzipUpdate(zipPath, extractionPath) {
|
||||
const zip = new AdmZip(zipPath);
|
||||
zip.extractAllTo(extractionPath, /*overwrite*/ true);
|
||||
}
|
||||
|
||||
module.exports = { compareAndUpdate, downloadUpdate, unzipUpdate };
|
||||
Reference in New Issue
Block a user