Skip to main content

Built and signed on GitHub Actions

Windows Named Pipes server and client module for Deno.

This package works with Deno
JSR Score
100%
Published
2 weeks ago (1.0.2)

@milly/namedpipe

license:MIT JSR Test codecov

Windows Named Pipes server and client module for Deno.

Requires allow-ffi, unstable-ffi permission.

Requirements

Deno v1.42 or later.

Example

Server

Can be used in the same way as Deno.listen.

import { listen } from "@milly/namedpipe";
import { TextLineStream } from "@std/streams/text-line-stream";

const listener = listen({ path: "\\\\.\\pipe\\your-own-name" });

for await (const conn of listener) {
  console.log("--- new conn ---");
  conn.readable
    .pipeThrough(new TextDecoderStream())
    .pipeThrough(new TextLineStream())
    .pipeTo(
      new WritableStream({
        write: (line) => console.log(line),
      }),
    );
}

Client

Can be used in the same way as Deno.connect.

import { connect } from "@milly/namedpipe";

const conn = await connect({ path: "\\\\.\\pipe\\your-own-name" });

await ReadableStream
  .from(["Hello\n", "World\n"])
  .pipeThrough(new TextEncoderStream())
  .pipeTo(conn.writable);

License

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

Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @milly/namedpipe

Import symbol

import * as mod from "@milly/namedpipe";