Files
ISA-Frontend/tools/download-file.js
Lorenz Hilpert 8ae990bcde Merged PR 1815: Angular Update V18
Related work items: #4830, #4834
2024-10-22 09:23:23 +00:00

24 lines
571 B
JavaScript

/**
* Script that downloads the swagger file from the given url
*/
const fetch = require('node-fetch');
const https = require('https');
const path = require('path');
const httpsAgent = new https.Agent({
rejectUnauthorized: false,
});
(async () => {
const url = process.argv[2];
const fileName = process.argv[3];
const res = await fetch(url, {
agent: httpsAgent,
});
// Write the file to the disk
const fileStream = require('fs').createWriteStream(fileName);
res.body.pipe(fileStream);
console.log('Swagger file downloaded successfully');
})();