# dev.knotless.getFile

> Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk)

✓ This is the authoritative definition for this NSID.

## Description

One file of a repository at a revision.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getFile)
- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getFile/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getFile/examples)

## Definitions

### `dev.knotless.getFile`

**Type**: `query`

One file at a revision: an image, a binary, too large to show, or text, with the ranges its highlighting paints. The bytes themselves are at the repository's raw path. No authentication needed; asked as an account, with a service token or the pages' session cookie, a private repository it is a member of is read too, and the answer is that account's alone.

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `path` | `string` | No | A path in the tree, from its root. |
| `ref` | `string` | No | A branch, a tag or a commit; the default branch if absent. It may run on into the path, as a web address names them: the longest branch or tag that starts it is the ref, and what follows goes before `path`. |
| `repo` | `string` (at-uri) | Yes | The repository's dev.knotless.repo record. Its authority may be a handle; a name the repository had before, or an owner it moved from with its agreement, finds it under the name it has now. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `html` | `string` | No | A Markdown file made into HTML, as a README is. |
| `kind` | `string` | Yes | How it is shown: only `text` comes with its text. |
| `lines` | `integer` | Yes |  |
| `path` | `string` | Yes | The file, from the root. |
| `ranges` | `string` | No | The ranges its highlighting paints, encoded as the pages read them. |
| `ref` | `string` | Yes | The ref or commit shown, as `ref` named it, less any path. |
| `size` | `integer` | Yes | In bytes. |
| `text` | `string` | No |  |

#### Errors

- **NotFound**: No such repository, revision, path or record.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "One file at a revision: an image, a binary, too large to show, or text, with the ranges its highlighting paints. The bytes themselves are at the repository's raw path. No authentication needed; asked as an account, with a service token or the pages' session cookie, a private repository it is a member of is read too, and the answer is that account's alone.",
      "errors": [
        {
          "description": "No such repository, revision, path or record.",
          "name": "NotFound"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "html": {
              "description": "A Markdown file made into HTML, as a README is.",
              "type": "string"
            },
            "kind": {
              "description": "How it is shown: only `text` comes with its text.",
              "knownValues": [
                "image",
                "binary",
                "large",
                "text"
              ],
              "type": "string"
            },
            "lines": {
              "minimum": 1,
              "type": "integer"
            },
            "path": {
              "description": "The file, from the root.",
              "type": "string"
            },
            "ranges": {
              "description": "The ranges its highlighting paints, encoded as the pages read them.",
              "type": "string"
            },
            "ref": {
              "description": "The ref or commit shown, as `ref` named it, less any path.",
              "type": "string"
            },
            "size": {
              "description": "In bytes.",
              "minimum": 0,
              "type": "integer"
            },
            "text": {
              "type": "string"
            }
          },
          "required": [
            "ref",
            "path",
            "kind",
            "size",
            "lines"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "path": {
            "description": "A path in the tree, from its root.",
            "maxLength": 4096,
            "type": "string"
          },
          "ref": {
            "description": "A branch, a tag or a commit; the default branch if absent. It may run on into the path, as a web address names them: the longest branch or tag that starts it is the ref, and what follows goes before `path`.",
            "maxLength": 1024,
            "type": "string"
          },
          "repo": {
            "description": "The repository's dev.knotless.repo record. Its authority may be a handle; a name the repository had before, or an owner it moved from with its agreement, finds it under the name it has now.",
            "format": "at-uri",
            "type": "string"
          }
        },
        "required": [
          "repo"
        ],
        "type": "params"
      },
      "type": "query"
    }
  },
  "description": "One file of a repository at a revision.",
  "id": "dev.knotless.getFile",
  "lexicon": 1
}
```
