Skip to main content

Built and signed on GitHub Actions

Simple logging library with zero dependencies for Deno/Node.js/Bun/browsers

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 weeks ago (0.8.0)
function getStreamSink
getStreamSink(): Sink & AsyncDisposable

A factory that returns a sink that writes to a WritableStream.

Note that the stream is of Web Streams API, which is different from Node.js streams. You can convert a Node.js stream to a Web Streams API stream using stream.Writable.toWeb() method.

Examples

Sink to the standard error in Deno

const stderrSink = getStreamSink(Deno.stderr.writable);

Sink to the standard error in Node.js

import stream from "node:stream";
const stderrSink = getStreamSink(stream.Writable.toWeb(process.stderr));

Parameters

The stream to write to.

optional
options: StreamSinkOptions

The options for the sink.

Return Type

Sink & AsyncDisposable

A sink that writes to the stream.

Add Package

deno add jsr:@logtape/logtape

Import symbol

import { getStreamSink } from "@logtape/logtape";

---- OR ----

Import directly with a jsr specifier

import { getStreamSink } from "jsr:@logtape/logtape";

Add Package

npx jsr add @logtape/logtape

Import symbol

import { getStreamSink } from "@logtape/logtape";

Add Package

yarn dlx jsr add @logtape/logtape

Import symbol

import { getStreamSink } from "@logtape/logtape";

Add Package

pnpm dlx jsr add @logtape/logtape

Import symbol

import { getStreamSink } from "@logtape/logtape";

Add Package

bunx jsr add @logtape/logtape

Import symbol

import { getStreamSink } from "@logtape/logtape";