Skip to content

Smart reader (for add operation) #69

@sergey-shandar

Description

@sergey-shandar
/** 
 * @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
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions