From ddbf9e93daab1e7593ee445c60676cfc7f635750 Mon Sep 17 00:00:00 2001 From: LuanRT Date: Tue, 6 Sep 2022 04:02:20 -0300 Subject: [PATCH] chore(docs): fix download example --- examples/download/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/download/index.ts b/examples/download/index.ts index 7c67e0a4..3fe48d3b 100644 --- a/examples/download/index.ts +++ b/examples/download/index.ts @@ -1,5 +1,6 @@ import { Innertube, UniversalCache } from 'youtubei.js'; import { readFileSync, existsSync, mkdirSync, createWriteStream } from 'fs'; +import { streamToIterable } from 'youtubei.js/dist/src/utils/Utils'; (async () => { const yt = await Innertube.create({ cache: new UniversalCache() }); @@ -32,7 +33,7 @@ import { readFileSync, existsSync, mkdirSync, createWriteStream } from 'fs'; } const file = createWriteStream(`${dir}/${song.title?.replace(/\//g, '')}.m4a`); - + for await (const chunk of streamToIterable(stream)) { file.write(chunk); }