# fs.barcode.render

Draw a code a scanner reads for --text and store it as --format svg|png (default svg)

# fs.barcode.render

```
fs.barcode.render --text TEXT [--symbology qr|code128] [--format svg|png] [--width N] [--height N] [--margin N] [--color TEXT] [--background TEXT] [--ecc L|M|Q|H] [--store TEXT] [--folder TEXT] [--filename TEXT] [--path TEXT] [--on-conflict error|skip|overwrite] → barcode
```

Draw a code a scanner reads for `--text` and store it as `--format svg|png` (default svg). `--symbology qr` (default) carries any text — a URL, a number — with `--ecc L|M|Q|H` (default M) trading size for damage tolerance; `--symbology code128` is a linear barcode for printable ASCII (a ticket or order number), digit runs packed two to a bar, `--height` its bar height (default 80). `--width` is the target width in px (qr 256, code128 300); `--margin` the light border in modules (qr 4, code128 10). Writes under `--folder` (default `barcodes`) as a generated name, as `--filename`, or at an exact `--path`; a named file that exists is an error unless `--on-conflict` says otherwise. Adds `barcode` — the durable FileRef (`ref`, `store`, `size`, …, `origin: fs.barcode.render`) with `symbology`, `format`, `width` and `height` in px — and keeps the rest of the payload.

## Flags

- `--text` (required): What the code carries; code128 takes printable ASCII only. Usually a {{ }} expression.
- `--symbology`: The code: qr (default) or code128.
- `--format`: svg (default) or png.
- `--width`: Target width in px (default: qr 256, code128 300).
- `--height`: code128 bar height in px (default 80); a QR Code is square and refuses it.
- `--margin`: Light border in modules (default: qr 4, code128 10).
- `--color`: Dark colour, #rgb or #rrggbb (default #000000).
- `--background`: Light colour, #rgb or #rrggbb (default #ffffff).
- `--ecc`: QR error correction (default M); code128 refuses it.
- `--store`: The project store to write to: `local`, or the id of an `s3` credential. Saved explicitly when the pipeline is registered (default: the project's default store at that moment)
- `--folder`: Destination folder (default: barcodes).
- `--filename`: Destination name without extension (default: a generated name).
- `--path`: Exact destination key; overrides --folder and --filename.
- `--on-conflict`: When the target already exists: overwrite, skip or error (default: error)

## Examples

### A verification link for a certificate

```
| fs.barcode.render --text "{{ 'https://example.com/certificates/' + input.number }}" --folder certificates/qr --filename "{{ input.number }}"
```

Input:

```json
{
  "number": "CERT-2026-0412"
}
```

It answers:

```json
{
  "number": "CERT-2026-0412",
  "barcode": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "certificates/qr/CERT-2026-0412.svg",
    "filename": "CERT-2026-0412.svg",
    "mime": "image/svg+xml",
    "kind": "image",
    "size": 2841,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.barcode.render",
    "trust": "generated",
    "symbology": "qr",
    "format": "svg",
    "width": 232,
    "height": 232
  }
}
```

### A ticket number as a linear barcode

```
| fs.barcode.render --symbology code128 --text "{{ input.ticket }}" --folder tickets/codes --filename "{{ input.ticket }}"
```

Input:

```json
{
  "ticket": "T-000481"
}
```

It answers:

```json
{
  "ticket": "T-000481",
  "barcode": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "tickets/codes/T-000481.svg",
    "filename": "T-000481.svg",
    "mime": "image/svg+xml",
    "kind": "image",
    "size": 1904,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.barcode.render",
    "trust": "generated",
    "symbology": "code128",
    "format": "svg",
    "width": 278,
    "height": 100
  }
}
```
