mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
24 lines
571 B
JavaScript
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');
|
|
})();
|