Skip to content

Commit

Permalink
Add global setup file
Browse files Browse the repository at this point in the history
  • Loading branch information
rockerBOO committed Jan 20, 2024
1 parent 9baa3a6 commit f4feb93
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions crates/lora-inspector-wasm/global-setup.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { createWriteStream } from "fs";
import { Readable } from "stream";

async function globalSetup(_config) {
const url =
"https://lora-inspector-test-files.us-east-1.linodeobjects.com/boo.safetensors";
const fileName = url.split("/").pop();
const resp = await fetch(url);
if (resp.ok && resp.body) {
console.log("Writing to file:", fileName);
let writer = createWriteStream(fileName);
Readable.fromWeb(resp.body).pipe(writer);
} else {
console.error("could not download the file");
}
};

export default globalSetup;

0 comments on commit f4feb93

Please sign in to comment.