lib/streams.js
function fromAsync(fn) {
  return new ReadableStream({
    pull: async controller => {
      try {
        controller.enqueue(await fn());
        controller.close();
      } catch(e) {
        controller.error(e);
      }
    }
  });
}
function fromAsync(fn) {
  return new ReadableStream({
    pull: async controller => {
      try {
        controller.enqueue(await fn());
        controller.close();
      } catch(e) {
        controller.error(e);
      }
    }
  });
}
function fromAsync ( fn ) { return new ReadableStream ( { pull : async controller => { try { controller . enqueue ( await fn ( ) ) ; controller . close ( ) ; } catch ( e ) { controller . error ( e ) ; } } } ) ; }
Convert an async function to a Stream. When the function returns, its return value is enqueued to the stream.
@param {Function} fn
@returns {ReadableStream}
Convert an async function to a Stream . When the function returns its return value is enqueued to the stream .