The API is great. Will definitely try it out. I have a use case already. How difficult would it be to extend this to support timed flushes? Like, every 200ms or so, regardless the fill of the buffer?

That's what the `window` option does (https://github.com/hackermondev/batched?tab=readme-ov-file#b...). After the first item is added to the buffer, it waits for the maximum window time, then calls the inner function with the buffer fill.