This commit is contained in:
Tommy D. Rossi
2026-02-22 15:21:38 +01:00
parent e475c2f582
commit f87b0243cd
101 changed files with 14997 additions and 11339 deletions
+17 -13
View File
@@ -14,19 +14,23 @@ const files: [string, string][] = [
function download(url: string, dest: string): Promise<void> {
return new Promise((resolve, reject) => {
https.get(url, (res) => {
if (res.statusCode !== 200) {
reject(new Error(`Failed to download ${url}: ${res.statusCode}`))
return
}
const chunks: Buffer[] = []
res.on('data', (chunk: Buffer) => { chunks.push(chunk) })
res.on('end', () => {
fs.writeFileSync(dest, Buffer.concat(chunks))
resolve()
https
.get(url, (res) => {
if (res.statusCode !== 200) {
reject(new Error(`Failed to download ${url}: ${res.statusCode}`))
return
}
const chunks: Buffer[] = []
res.on('data', (chunk: Buffer) => {
chunks.push(chunk)
})
res.on('end', () => {
fs.writeFileSync(dest, Buffer.concat(chunks))
resolve()
})
res.on('error', reject)
})
res.on('error', reject)
}).on('error', reject)
.on('error', reject)
})
}
@@ -34,7 +38,7 @@ async function main() {
await Promise.all(
files.map(([src, dest]) => {
return download(BASE + src, path.join(DEST, dest))
})
}),
)
console.log(`Downloaded ${files.length} Prism.js files to ${DEST}`)
}