Skip to content

ky equivalent of got.stream ? #558

Answered by sindresorhus
PixeledCode asked this question in Q&A
Discussion options

You must be logged in to vote

Ky does not currently support streaming, but you could use fetch directly:

import {createWriteStream} from 'node:fs';
import {pipeline} from 'node:stream/promises';

const response = await fetch(url);
await pipeline(response.body, createWriteStream(tempFile));

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by PixeledCode
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants