ts-graphviz
    Preparing search index...

    Module @ts-graphviz/adapter - v3.0.2

    Main CodeQL License: MIT All Contributors

    OpenSSF Best Practices OpenSSF Scorecard Tidelift

    npm version node version deno version npm

    @ts-graphviz/adapter

    Cross-platform interfaces for executing Graphviz DOT commands in various JavaScript runtimes.

    🔗

    GitHub npm Reference Ask DeepWiki

    Sponsor OpenCollective

    format: Biome test: Vitest build: Vite


    It is part of the ts-graphviz library, which is split into modular packages to improve maintainability, flexibility, and ease of use.

    This library enables rendering DOT language strings into different output formats through platform-specific implementations for Node.js, and Deno.

    Graphviz must be installed so that the dot command can be executed.

    Execute the dot command to output a DOT language string to a stream or file.

    Adapter State Machine

    The adapter provides two main functions for working with DOT language strings:

    The toStream function converts a DOT language string to a readable stream of the specified output format.

    import { toStream } from '@ts-graphviz/adapter';

    const dot = `
    digraph example {
    node1 [
    label = "My Node",
    ]
    }
    `;

    const stream = await toStream(dot, { format: 'svg' });
    // Node.js
    stream.pipe(process.stdout);
    // Deno
    await stream.pipeTo(Deno.stdout.writable);

    The toFile function writes the rendered output directly to a file at the specified path.

    import { toFile } from '@ts-graphviz/adapter';

    const dot = `
    digraph example {
    node1 [
    label = "My Node",
    ]
    }
    `;

    await toFile(dot, './result.svg', { format: 'svg' });

    Both functions accept configuration options to customize the rendering process.

    Thanks goes to these wonderful people (emoji key):

    Yuki Yamazaki
    Yuki Yamazaki

    💻 ⚠️ 📖 🤔
    LaySent
    LaySent

    🐛 ⚠️
    elasticdotventures
    elasticdotventures

    📖
    Christian Murphy
    Christian Murphy

    💻 🤔 📖
    Artem
    Artem

    🐛
    fredericohpandolfo
    fredericohpandolfo

    🐛
    diegoquinteiro
    diegoquinteiro

    🐛
    robross0606
    robross0606

    🤔
    Blake Regalia
    Blake Regalia

    🐛
    bigbug
    bigbug

    💬
    mrwk
    mrwk

    💬
    svdvonde
    svdvonde

    💬
    Adam
    Adam

    💬
    Trevor Scheer
    Trevor Scheer

    ️️️️♿️
    Prem Pillai
    Prem Pillai

    🐛
    nagasawaryoya
    nagasawaryoya

    💻 ⚠️
    YukiSasaki
    YukiSasaki

    💻 ⚠️
    Madd0g
    Madd0g

    🐛
    j4k0xb
    j4k0xb

    🐛
    HKrogstie
    HKrogstie

    🐛
    Nils K
    Nils K

    🐛
    hao2013
    hao2013

    🚧 👀
    Walter Rafelsberger
    Walter Rafelsberger

    💬
    grsjst
    grsjst

    🐛
    Steve
    Steve

    🐛

    This project follows the all-contributors specification. Contributions of any kind welcome!

    See CHANGELOG.md for more details.

    This software is released under the MIT License, see LICENSE.

    Namespaces

    Format
    Layout

    Interfaces

    CommonOptions
    FdpOptions
    NeatoOptions
    OtherOptions

    Type Aliases

    Format
    Layout
    Options

    Functions

    toFile
    toStream