Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart reader (for add operation) #69

Open
sergey-shandar opened this issue Nov 14, 2023 · 0 comments
Open

Smart reader (for add operation) #69

sergey-shandar opened this issue Nov 14, 2023 · 0 comments

Comments

@sergey-shandar
Copy link

sergey-shandar commented Nov 14, 2023

/** 
 * @type {(read: (size: number) => Promise<UInt8Array>) => 
 *  (size: number) =>
 *  () => Promise<UInt8Array>
 * } 
 */
const reader = read => size => {
  let next = read(size)
  return async () => {
     let current = next
     next = current.then(() => read(size))
     return current
  }
}
@sergey-shandar sergey-shandar changed the title Smart reader Smart reader (for add operation) Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant