unified

Project: unifiedjs/unified-stream

Package: unified-stream@2.0.0

  1. Dependents: 24
  2. Streaming interface for unified processors
  1. unified 173

unified-stream

Build Coverage Downloads Sponsors Backers Chat

Streaming interface to unified processors.

Note that the interface is streaming, but the code buffers.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install unified-stream

Use

The below example pipes stdin, into an HTML formatter, to stdout.

import {stream} from 'unified-stream'
import {unified} from 'unified'
import rehypeParse from 'rehype-parse'
import rehypeFormat from 'rehype-format'
import rehypeStringify from 'rehype-stringify'

process.stdin
  .pipe(
    stream(unified().use(rehypeParse).use(rehypeFormat).use(rehypeStringify))
  )
  .pipe(process.stdout)

API

This package exports the following identifiers: stream. There is no default export.

stream(processor)

Create a readable/writable stream that transforms with processor.

Contribute

See contributing.md in unifiedjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer