@sz-sw/async-buf
Asynchronous buffer:
const AsyncBuffer = require("@sz-sw/async-buf")
const buffer = AsyncBuffer.create()
async function main() {
console.log(await buffer.read(4)) // [1, 2, 3, 4]
console.log(await buffer.read(1)) // [5]
}
setTimeout(() => {
buffer.fill([1, 2])
buffer.fill([3, 4, 5])
}, 100)
main()