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) • 709 B
text/typescript
import { createReadStream } from "node:fs";
import { fromReadable } from "./lib/from-node-stream";
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"]);
});