# plotwork read

> Page: https://docs.plotwork.dev/cli/commands/read. Index of every page: https://docs.plotwork.dev/llms.txt

Print the source a Plotwork SVG, a view link, or a hosted link carries, to edit it. It is a command of the Plotwork command line, the npm package `@buun_group/plotwork`.

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Print the source a Plotwork SVG, a view link, or a hosted link carries, to edit it. |
| How do I run it? | `npx -y @buun_group/plotwork@0.1.0 read`, or `plotwork read` once the package is installed. |
| What does it write? | The source, only with `--out`. |
| Does it use the network? | Only for a hosted link: one request for that picture. A file or a view link is read on this machine. |
| Does it read the repository settings? | No. |
| How do I read this in a terminal? | `plotwork read --help` |

## Synopsis

```sh
plotwork read <file.svg|link> [--out <file>]
```

## What it does

Prints the source a Plotwork picture carries, so the diagram can be changed and drawn again. The target is an SVG file, a view link a tool returned, or a hosted link such as `https://cdn.plotwork.dev/d/<token>.svg`.

The source goes to standard output, or to `--out`, and everything else to standard error, so `plotwork read picture.svg > picture.diagram` writes only the source. A picture with no embedded source prints what can be read from it, such as its title and labels, and exits 1.

## Options

| Option | Default | What it does |
|---|---|---|
| `--out <file>` | standard output | Write the source to a file. |

## Examples

Get the source back from a picture in the repository.

```sh
plotwork read docs/assets/diagrams/flow.svg > flow.diagram
```

Get the source of a hosted picture.

```sh
plotwork read https://cdn.plotwork.dev/d/<token>.svg --out flow.diagram
```

## Exit codes

| Code | When |
|---|---|
| `0` | The source was printed or written. |
| `1` | The picture carries no source, the source has errors, or a hosted link could not be read. |
| `2` | A mistake in the command line: an unknown option, a missing operand, a file or glob that matches nothing, or a settings file that cannot be read. |

## See also

| Doc | Why |
|---|---|
| [Command reference](https://docs.plotwork.dev/cli/commands.md) | Every command of the command line |
| [Editing an existing diagram](https://docs.plotwork.dev/editing-existing-diagrams.md) | Change a picture you already have |
| [Hosted diagrams](https://docs.plotwork.dev/hosted-diagrams.md) | The links read fetches |
| [Exit codes and output formats](https://docs.plotwork.dev/cli/exit-codes-and-output.md) | What every code and format means |
