Created
December 26, 2022 17:13
-
-
Save Northernside/35e2eafc4f14338aee6deac63a70e8c7 to your computer and use it in GitHub Desktop.
☕️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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