> For the complete documentation index, see [llms.txt](https://docs.specifyapp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.specifyapp.com/reference/parsers/to-file.md).

# to-file

## Interface

```typescript
interface parser {
  name: 'to-file';
  options: {
    filenameTemplate: string;
  };
  output: {
    type: 'directory';
    directoryPath: string;
  };
};
```

## Options

<table data-full-width="true"><thead><tr><th width="221">Parameter</th><th width="100">Required</th><th width="100">Type</th><th width="483">Default</th><th width="507">Description</th></tr></thead><tbody><tr><td><code>filenameTemplate</code></td><td><code>false</code></td><td><code>string</code></td><td><code>"{{parents}}/{{name}}[-{{mode}}]{{extension}}"</code></td><td>The mustache template used to generate the file path to write to the file system.<br>Available variables:<br><code>parents</code>: group and collection names of the token's parents<br><code>name</code>: the name of the asset token<br><code>mode</code>: the name of the current mode<br><code>extension</code>: the file extension extracted from the token</td></tr></tbody></table>

## Basic usage

{% tabs %}
{% tab title="Input" %}
{% code lineNumbers="true" %}

```json
{
  "fonts": {
    "inter-regular": {
      "$type": "font",
      "$value": {
        "default": {
          "family": "Inter Regular",
          "postScriptName": "Inter Regular",
          "weight": "regular",
          "style": "normal",
          "files": [
            {
              "format": "ttf",
              "url": "https://static.specifyapp.com/sdtf-seeds/inter-regular.ttf",
              "provider": "Specify"
            }
          ]
        }
      }
    }
  }
}
```

{% endcode %}
{% endtab %}

{% tab title="Config" %}
{% code title=".specifyrc.json" lineNumbers="true" %}

```json
{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "Generate images",
      "parsers": [
        {
          "name": "to-file",
          "options": {
            "filenameTemplate": "{{name}}{{extension}}"
          },
          "output": {
            "type": "directory",
            "directoryPath": "public"
          }
        }
      ]
    }
  ]
}
```

{% endcode %}
{% endtab %}

{% tab title="Output" %}
This will generate the corresponding font file binary, named after the `filenameTemplate`.

* public/inter-regular.ttf
  {% endtab %}
  {% endtabs %}
