mirror of
https://github.com/fergalmoran/mixyboos.git
synced 2025-12-22 09:41:39 +00:00
16 lines
344 B
TypeScript
16 lines
344 B
TypeScript
///
|
|
// synchronous file downloader for use in tests
|
|
///
|
|
import fs from "fs";
|
|
import fetch from "node-fetch";
|
|
|
|
const downloadFile = async (url: string, path: string) => {
|
|
const response = await fetch(url);
|
|
const bytes = await response.arrayBuffer();
|
|
fs.writeFileSync(path, Buffer.from(bytes));
|
|
|
|
return path;
|
|
};
|
|
|
|
export { downloadFile };
|