@sanity/migrate
Version:
Tooling for running data migrations on Sanity.io projects
14 lines (13 loc) • 363 B
text/typescript
/**
* Helper to drain a stream, useful in cases where you want to keep reading a stream but disregard the received chunks.
* @param stream - the readable stream to drain
*/
export async function drain(stream: ReadableStream) {
const reader = stream.getReader()
while (true) {
const {done} = await reader.read()
if (done) {
return
}
}
}