---
title: "file.exportBytes: Export to Data — Vector kit command — Kition"
description: "Answers the document, its selection or chosen artboards as a file in a format (SVG, PDF, PNG, JPEG, TIFF, PSD, DXF, EPS and more) with file.export's options, as base64 `data` (with `files` when the format writes one file per artboard), without writing a file or changing the document: the host writes it."
canonical: "https://developer.kition.ai/docs/kits/vector/commands/file.exportBytes"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/vector/commands/file.exportBytes](https://developer.kition.ai/docs/kits/vector/commands/file.exportBytes)

# file.exportBytes

**Export to Data.** Answers the document, its selection or chosen artboards as a file in a format (SVG, PDF, PNG, JPEG, TIFF, PSD, DXF, EPS and more) with file.export's options, as base64 `data` (with `files` when the format writes one file per artboard), without writing a file or changing the document: the host writes it.

- Kit: Vector 0.1.0 (.kvector); reference: [Vector kit commands](https://developer.kition.ai/docs/kits/vector.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `all` | `boolean` | no | 1-based; PDF writes one page per artboard, default all; SVG writes one file per artboard, {stem}-{artboard}.svg; raster formats write one artboard; one of several alternative parameters |
| `antiAlias` | `"none" \| "art" \| "type"` | no | default; raster; type: text snapped to pixels |
| `artboard` | `integer` | no |  |
| `artboards` | `any[]` | no |  |
| `background` | `string` | no |  |
| `byteOrder` | `"little" \| "big"` | no | tiff |
| `colorModel` | `"rgb" \| "cmyk" \| "gray"` | no | jpg, tiff, psd; bmp: rgb\|gray; tiff: rgb keeps transparency as an alpha channel |
| `colors` | `integer` | no | gif and png8: 2–256 |
| `depth` | `integer` | no | bmp: 1 black and white, 4\|8 a palette by reduction and dither, 16, 24, 32 with alpha; tga: 16 one-bit alpha, 24, 32 with alpha |
| `dither` | `"none" \| "diffusion" \| "pattern" \| "noise"` | no | default; gif and png8 |
| `ditherAmount` | `integer` | no | gif and png8 |
| `embedIcc` | `boolean` | no | jpg, tiff, psd |
| `encoding` | `"utf8" \| "utf16"` | no | txt, the stories in stacking order, back to front, a thread once: utf16 with a byte order mark; also an SVG option |
| `fileFormat` | `"windows" \| "os2"` | no | bmp: 1, 4, 8 or 24 bits |
| `flipRows` | `boolean` | no | bmp: top-down rows |
| `format` | `"svg" \| "svgz" \| "pdf" \| "png" \| "jpg" \| "webp" \| "gif" \| "png8" \| "txt" \| "dxf" \| "eps" \| "emf" \| "wmf" \| "tiff" \| "bmp" \| "tga" \| "psd" \| "kvector" \| "template"` | no | default: from the path's extension, else png; png8 writes an indexed .png |
| `hiddenLayers` | `boolean` | no | psd: hidden layers and objects written hidden instead of left out; also an SVG option |
| `imageMap` | `"none" \| "client" \| "server"` | no | jpg: an HTML or NCSA map of the objects with a URL, written as <stem>.html / <stem>.map |
| `interlaced` | `boolean` | no |  |
| `layers` | `boolean` | no | psd: each top-level layer a pixel layer with its opacity and blend mode; a background colour is a Background layer; false: one flat image, on white |
| `lineEndings` | `"lf" \| "crlf"` | no | txt |
| `lossless` | `boolean` | no | webp: lossy WebP isn't available yet: written lossless, with a warning |
| `lzw` | `boolean` | no | tiff |
| `matte` | `string` | no |  |
| `maxEditability` | `boolean` | no | psd: layers and sublayers become groups, each object a layer named as in the Layers panel, text by its text; clipping, masked or knockout layers stay one layer |
| `method` | `"baseline" \| "optimized" \| "progressive"` | no | jpg |
| `ppi` | `number` | no | raster: pixels per inch, stored in the file; wins over scale |
| `quality` | `integer` | no | jpg: 0–100; webp: for when lossy WebP is available |
| `range` | `string` | no | like 1-3, 5; one of several alternative parameters |
| `reduction` | `"perceptual" \| "selective" \| "adaptive" \| "web" \| "blackWhite" \| "gray"` | no | default; gif and png8 |
| `rle` | `boolean` | no | bmp: 4 and 8 bits, windows |
| `scale` | `number` | no | raster: pixels per point |
| `scans` | `integer` | no | jpg: 3–5, progressive |
| `selectedOnly` | `boolean` | no | the selected objects alone, in their layers |
| `selectionOnly` | `boolean` | no |  |
| `svg` | `object` | no | styling, outlineText, images, objectIds, decimals, minify, responsive, useArtboards, preserveEditing, metadata, fewerTspans, hiddenLayers, encoding, profile, embedFonts: see file.formats; SVG options flat or in svg |
| `transparency` | `boolean` | no | gif and png8 |
| `useArtboards` | `"true" \| "false"` | no | raster: one file per chosen artboard, default all, {stem}-{artboard}.{ext}; pdf: every page; emf/wmf: one file per chosen artboard; pdf/raster/emf/wmf: the bounds of the visible art; SVG has it as an SVG option |

## Call through vector_run

```text
vector_run {
  "path": "<file>.kvector",
  "steps": [{ "command": "file.exportBytes" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `all`, `antiAlias`, `artboard`, `artboards`, `background`, `byteOrder`, `colorModel`, `colors`, `depth`, `dither`, `ditherAmount`, `embedIcc`, `encoding`, `fileFormat`, `flipRows`, `format`, `hiddenLayers`, `imageMap`, `interlaced`, `layers`, `lineEndings`, `lossless`, `lzw`, `matte`, `maxEditability`, `method`, `ppi`, `quality`, `range`, `reduction`, `rle`, `scale`, `scans`, `selectedOnly`, `selectionOnly`, `svg`, `transparency`, `useArtboards`. vector_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `bytes` | `number` | no |  |
| `data` | `string` | no |  |
| `files` | `any[]` | no |  |
| `format` | `string` | no |  |
| `linked` | `any[]` | no |  |
| `warnings` | `any[]` | no |  |

```json
{
  "additionalProperties": true,
  "properties": {
    "bytes": {
      "type": "number"
    },
    "data": {
      "type": "string"
    },
    "files": {
      "type": "array"
    },
    "format": {
      "type": "string"
    },
    "linked": {
      "type": "array"
    },
    "warnings": {
      "type": "array"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "all": {
      "description": "1-based; PDF writes one page per artboard, default all; SVG writes one file per artboard, {stem}-{artboard}.svg; raster formats write one artboard; one of several alternative parameters",
      "type": "boolean"
    },
    "antiAlias": {
      "description": "default; raster; type: text snapped to pixels",
      "enum": [
        "none",
        "art",
        "type"
      ],
      "type": "string"
    },
    "artboard": {
      "default": 0,
      "type": "integer"
    },
    "artboards": {
      "type": "array"
    },
    "background": {
      "type": "string"
    },
    "byteOrder": {
      "description": "tiff",
      "enum": [
        "little",
        "big"
      ],
      "type": "string"
    },
    "colorModel": {
      "description": "jpg, tiff, psd; bmp: rgb|gray; tiff: rgb keeps transparency as an alpha channel",
      "enum": [
        "rgb",
        "cmyk",
        "gray"
      ],
      "type": "string"
    },
    "colors": {
      "default": 256,
      "description": "gif and png8: 2–256",
      "type": "integer"
    },
    "depth": {
      "default": 24,
      "description": "bmp: 1 black and white, 4|8 a palette by reduction and dither, 16, 24, 32 with alpha; tga: 16 one-bit alpha, 24, 32 with alpha",
      "type": "integer"
    },
    "dither": {
      "description": "default; gif and png8",
      "enum": [
        "none",
        "diffusion",
        "pattern",
        "noise"
      ],
      "type": "string"
    },
    "ditherAmount": {
      "default": 100,
      "description": "gif and png8",
      "type": "integer"
    },
    "embedIcc": {
      "default": true,
      "description": "jpg, tiff, psd",
      "type": "boolean"
    },
    "encoding": {
      "description": "txt, the stories in stacking order, back to front, a thread once: utf16 with a byte order mark; also an SVG option",
      "enum": [
        "utf8",
        "utf16"
      ],
      "type": "string"
    },
    "fileFormat": {
      "description": "bmp: 1, 4, 8 or 24 bits",
      "enum": [
        "windows",
        "os2"
      ],
      "type": "string"
    },
    "flipRows": {
      "default": false,
      "description": "bmp: top-down rows",
      "type": "boolean"
    },
    "format": {
      "description": "default: from the path's extension, else png; png8 writes an indexed .png",
      "enum": [
        "svg",
        "svgz",
        "pdf",
        "png",
        "jpg",
        "webp",
        "gif",
        "png8",
        "txt",
        "dxf",
        "eps",
        "emf",
        "wmf",
        "tiff",
        "bmp",
        "tga",
        "psd",
        "kvector",
        "template"
      ],
      "type": "string"
    },
    "hiddenLayers": {
      "default": false,
      "description": "psd: hidden layers and objects written hidden instead of left out; also an SVG option",
      "type": "boolean"
    },
    "imageMap": {
      "description": "jpg: an HTML or NCSA map of the objects with a URL, written as <stem>.html / <stem>.map",
      "enum": [
        "none",
        "client",
        "server"
      ],
      "type": "string"
    },
    "interlaced": {
      "type": "boolean"
    },
    "layers": {
      "default": true,
      "description": "psd: each top-level layer a pixel layer with its opacity and blend mode; a background colour is a Background layer; false: one flat image, on white",
      "type": "boolean"
    },
    "lineEndings": {
      "description": "txt",
      "enum": [
        "lf",
        "crlf"
      ],
      "type": "string"
    },
    "lossless": {
      "default": true,
      "description": "webp: lossy WebP isn't available yet: written lossless, with a warning",
      "type": "boolean"
    },
    "lzw": {
      "default": true,
      "description": "tiff",
      "type": "boolean"
    },
    "matte": {
      "type": "string"
    },
    "maxEditability": {
      "default": false,
      "description": "psd: layers and sublayers become groups, each object a layer named as in the Layers panel, text by its text; clipping, masked or knockout layers stay one layer",
      "type": "boolean"
    },
    "method": {
      "description": "jpg",
      "enum": [
        "baseline",
        "optimized",
        "progressive"
      ],
      "type": "string"
    },
    "ppi": {
      "default": 72,
      "description": "raster: pixels per inch, stored in the file; wins over scale",
      "type": "number"
    },
    "quality": {
      "default": 90,
      "description": "jpg: 0–100; webp: for when lossy WebP is available",
      "type": "integer"
    },
    "range": {
      "description": "like 1-3, 5; one of several alternative parameters",
      "type": "string"
    },
    "reduction": {
      "description": "default; gif and png8",
      "enum": [
        "perceptual",
        "selective",
        "adaptive",
        "web",
        "blackWhite",
        "gray"
      ],
      "type": "string"
    },
    "rle": {
      "default": false,
      "description": "bmp: 4 and 8 bits, windows",
      "type": "boolean"
    },
    "scale": {
      "default": 1,
      "description": "raster: pixels per point",
      "type": "number"
    },
    "scans": {
      "default": 3,
      "description": "jpg: 3–5, progressive",
      "type": "integer"
    },
    "selectedOnly": {
      "default": false,
      "description": "the selected objects alone, in their layers",
      "type": "boolean"
    },
    "selectionOnly": {
      "type": "boolean"
    },
    "svg": {
      "additionalProperties": true,
      "description": "styling, outlineText, images, objectIds, decimals, minify, responsive, useArtboards, preserveEditing, metadata, fewerTspans, hiddenLayers, encoding, profile, embedFonts: see file.formats; SVG options flat or in svg",
      "type": "object"
    },
    "transparency": {
      "default": true,
      "description": "gif and png8",
      "type": "boolean"
    },
    "useArtboards": {
      "description": "raster: one file per chosen artboard, default all, {stem}-{artboard}.{ext}; pdf: every page; emf/wmf: one file per chosen artboard; pdf/raster/emf/wmf: the bounds of the visible art; SVG has it as an SVG option",
      "enum": [
        "true",
        "false"
      ],
      "type": "string"
    }
  },
  "returns": "{data (the file, base64; the first when the format writes several), format, bytes, warnings, files?: [{name, data}] (several), linked?: [{name, data}]}. Never changes the document",
  "type": "object"
}
```

Generated from the command list of @kition/vector-darwin-arm64@0.1.0 and the kit itself (vector_commands through @kition/cli@0.1.1, built from KitionAI/kition-vector@7cf908f).
