0.0.2 • Published 1 year ago

promiscade v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

promiscade

promiscade provides utilities to convert ReadableStream to cascading of Promise objects, and vice versa.

Installation

npm install promiscade

Usage

Converting ReadableStream to Promiscade

import { streamToPromiscade } from "promiscade";

const stream = new ReadableStream<string>({
  start(controller) {
    controller.enqueue("a");
    controller.enqueue("b");
    controller.enqueue("c");
    controller.close();
  },
});

const promiscade = streamToPromiscade(stream);

Converting Promiscade to ReadableStream

import { promiscadeToReadableStream } from "promiscade";

const cade = Promise.resolve({
  value: "a",
  done: false,
  next: Promise.resolve({
    value: "b",
    done: false,
    next: Promise.resolve({
      value: "c",
      done: false,
      next: Promise.resolve({
        done: true,
      }),
    }),
  }),
});

const stream = promiscadeToReadableStream(cade);

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

0.0.2

1 year ago

0.0.2-alpha.0

1 year ago

0.0.1

1 year ago

0.0.1-alpha.1

1 year ago

0.0.0-alpha.0

1 year ago