Skip to content

Instantly share code, notes, and snippets.

@Northernside
Created December 26, 2022 17:13
Show Gist options
  • Save Northernside/35e2eafc4f14338aee6deac63a70e8c7 to your computer and use it in GitHub Desktop.
Save Northernside/35e2eafc4f14338aee6deac63a70e8c7 to your computer and use it in GitHub Desktop.
☕️
import {Readable} from "node:stream";
import {finished} from "node:stream/promises";
import FS from "node:fs";
for (let i = 1; i <= 200; i++) {
const {body, status} = await fetch(`https://git.laby.tech/uploads/-/system/user/avatar/${i}/avatar.png`);
if (status !== 200)
continue;
const stream = FS.createWriteStream(`avatar/${i}.png`);
await finished(Readable.fromWeb(body).pipe(stream));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment