@vulkano/core 1.8.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap/server.js +1 -12
- package/libs/Download.js +23 -0
- package/package.json +1 -1
package/bootstrap/server.js
CHANGED
|
@@ -430,11 +430,8 @@ module.exports = function loadServer() {
|
|
|
430
430
|
|
|
431
431
|
// ---------------
|
|
432
432
|
// PUBLIC PATH - File: app/config/settings.js
|
|
433
|
-
// (if are using Vite)
|
|
434
433
|
// ---------------
|
|
435
|
-
|
|
436
|
-
vulkano.use(express.static(PUBLIC_PATH));
|
|
437
|
-
}
|
|
434
|
+
vulkano.use(express.static(PUBLIC_PATH));
|
|
438
435
|
|
|
439
436
|
// ---------------
|
|
440
437
|
// ROUTES
|
|
@@ -579,14 +576,6 @@ module.exports = function loadServer() {
|
|
|
579
576
|
}
|
|
580
577
|
});
|
|
581
578
|
|
|
582
|
-
// ---------------
|
|
583
|
-
// PUBLIC PATH
|
|
584
|
-
// (if not are using Vite)
|
|
585
|
-
// ---------------
|
|
586
|
-
if (app.viteProxy) {
|
|
587
|
-
vulkano.use(express.static(PUBLIC_PATH));
|
|
588
|
-
}
|
|
589
|
-
|
|
590
579
|
app.vulkano = vulkano;
|
|
591
580
|
app.server = server;
|
|
592
581
|
|
package/libs/Download.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
module.exports = (url, dest) => {
|
|
6
|
+
|
|
7
|
+
const file = fs.createWriteStream(dest);
|
|
8
|
+
|
|
9
|
+
const protocol = (url.indexOf('http:') >= 0) ? http : https;
|
|
10
|
+
|
|
11
|
+
return new Promise( (resolve, reject) => {
|
|
12
|
+
protocol.get(url, (response) => {
|
|
13
|
+
response.pipe(file);
|
|
14
|
+
file.on('finish', () => {
|
|
15
|
+
file.close(resolve);
|
|
16
|
+
});
|
|
17
|
+
file.on('error', (error) => {
|
|
18
|
+
reject(error);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
};
|