So, I'm building a library and as a part of that library I want to create stream processing operators. One of those operators is called tap. It takes a stream of data, and for each chunk performs some callback, and then passed the chunk on, kinda like a PassThrough. Here's my code:const tap = sideEffect => new Transform({ objectMode: true, transform(chunk, _, callback) { sideEffect(chunk); this.push(chunk); callback(); } });This seems to work for the first 16 chunks (which makes sense), but then completely stops. What exactly am I missing to get this to work? 🤔
Submitted November 18, 2019 at 02:54PM by notAnotherJSDev
No comments:
Post a Comment