Skip to content Skip to sidebar Skip to footer

How To Emit Values Of A Certain Buffer Size With A Delay Between Each Group

I have large observable of values, where I want to chunk it into fixed sizes, and then emit each chunk with a delay until finished. To be a bit more concrete, my scenario is where

Solution 1:

You might want to try the following:

 const source = range(1, 1000);

 const example = source
   .pipe(
     bufferCount(10),
     concatMap(x => of(x).pipe(delay(5000))),
    );
   
 const subscribe = example.subscribe(val =>
   console.log('output:', val)
 );

Post a Comment for "How To Emit Values Of A Certain Buffer Size With A Delay Between Each Group"