UNPKG

sflow

Version:

sflow is a powerful and highly-extensible library designed for processing and manipulating streams of data effortlessly. Inspired by the functional programming paradigm, it provides a rich set of utilities for transforming streams, including chunking, fil

34 lines (31 loc) 698 B
import { createReadStream } from "fs"; import { fromReadable } from "./fromNodeStream"; import { sflow } from "./sflow"; it("froms", async () => { console.log("froms"); await sflow(fromReadable(createReadStream("./README.md"))) .map((buffer) => buffer.toString()) .lines() .riffle(">") .toLog(); }); it("read string as array ", async () => { const flow = sflow("hello world"); expect(await flow.toArray()).toEqual([ "h", "e", "l", "l", "o", " ", "w", "o", "r", "l", "d", ]); }); it("read string array as array", async () => { const flow = sflow(["hello world"]); expect(await flow.toArray()).toEqual(["hello world"]); });