# party.whey.files.defs

- Kind: defs
- Authority: files.whey.party
- Lexicon: 1
- Published by [whey.party](https://lexicon.garden/identity/did:plc:mn45tewwnse5btfftvd3powc), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:mn45tewwnse5btfftvd3powc/party.whey.files.defs)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:mn45tewwnse5btfftvd3powc/party.whey.files.defs/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:mn45tewwnse5btfftvd3powc/party.whey.files.defs/analytics)

## #file (`party.whey.files.defs#file`)

Type: object

The ordered bytes of a file. All chunks except the last are exactly chunkSize; the last is 1..chunkSize. size is the sum of chunk sizes.

### Properties

- `chunkSize` (integer, required): Nominal chunk size in bytes. The last chunk may be smaller. 4 MiB is the default; 64 MiB is the protocol ceiling.
  - Constraints: minimum: 65536, maximum: 67108864
- `chunks` (array, required)
  - Constraints: maxLength: 4096
  - `items` (blob)
    - Constraints: maxSize: 67108864, accept: */*
- `mimeType` (string, required)
  - Constraints: maxLength: 255
- `sha256` (bytes): Optional whole-file SHA-256. Client-asserted; writers with no read access cannot verify it. Readers and fsck verify when present.
  - Constraints: minLength: 32, maxLength: 32
- `size` (integer, required): Total bytes. Must equal the sum of chunk sizes.
  - Constraints: minimum: 0

## #parent (`party.whey.files.defs#parent`)

Type: object

A soft reference to this drive's root meta record or to a directory record. The drive identity and authority are implicit. A file or link is never a parent.

### Properties

- `collection` (string · nsid, required)
  - Constraints: enum: party.whey.files.meta | party.whey.files.dir
- `rkey` (string · record-key, required): The parent's record key. It is 'self' when collection is the meta record, and a TID when collection is a directory.

## #posix (`party.whey.files.defs#posix`)

Type: object

Advisory POSIX metadata. Never enforced as a security boundary. Writers must set explicit values; readers must not invent different ones.

### Properties

- `atime` (string · datetime)
- `ctime` (string · datetime)
- `gid` (integer, required)
  - Constraints: minimum: 0
- `mode` (integer, required): Permission bits only (0o7777). The file type is carried by the record collection.
  - Constraints: minimum: 0, maximum: 4095
- `mtime` (string · datetime, required)
- `uid` (integer, required)
  - Constraints: minimum: 0

## #trashedFrom (`party.whey.files.defs#trashedFrom`)

Type: object

Where a trashed node came from, so it can be restored.

### Properties

- `name` (string, required)
  - Constraints: minLength: 1, maxLength: 255
- `parent` (ref, required)
  - Reference: `#parent`

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "file": {
      "description": "The ordered bytes of a file. All chunks except the last are exactly chunkSize; the last is 1..chunkSize. size is the sum of chunk sizes.",
      "properties": {
        "chunkSize": {
          "description": "Nominal chunk size in bytes. The last chunk may be smaller. 4 MiB is the default; 64 MiB is the protocol ceiling.",
          "maximum": 67108864,
          "minimum": 65536,
          "type": "integer"
        },
        "chunks": {
          "items": {
            "accept": [
              "*/*"
            ],
            "maxSize": 67108864,
            "type": "blob"
          },
          "maxLength": 4096,
          "type": "array"
        },
        "mimeType": {
          "maxLength": 255,
          "type": "string"
        },
        "sha256": {
          "description": "Optional whole-file SHA-256. Client-asserted; writers with no read access cannot verify it. Readers and fsck verify when present.",
          "maxLength": 32,
          "minLength": 32,
          "type": "bytes"
        },
        "size": {
          "description": "Total bytes. Must equal the sum of chunk sizes.",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "size",
        "mimeType",
        "chunkSize",
        "chunks"
      ],
      "type": "object"
    },
    "parent": {
      "description": "A soft reference to this drive's root meta record or to a directory record. The drive identity and authority are implicit. A file or link is never a parent.",
      "properties": {
        "collection": {
          "enum": [
            "party.whey.files.meta",
            "party.whey.files.dir"
          ],
          "format": "nsid",
          "type": "string"
        },
        "rkey": {
          "description": "The parent's record key. It is 'self' when collection is the meta record, and a TID when collection is a directory.",
          "format": "record-key",
          "type": "string"
        }
      },
      "required": [
        "collection",
        "rkey"
      ],
      "type": "object"
    },
    "posix": {
      "description": "Advisory POSIX metadata. Never enforced as a security boundary. Writers must set explicit values; readers must not invent different ones.",
      "properties": {
        "atime": {
          "format": "datetime",
          "type": "string"
        },
        "ctime": {
          "format": "datetime",
          "type": "string"
        },
        "gid": {
          "minimum": 0,
          "type": "integer"
        },
        "mode": {
          "description": "Permission bits only (0o7777). The file type is carried by the record collection.",
          "maximum": 4095,
          "minimum": 0,
          "type": "integer"
        },
        "mtime": {
          "format": "datetime",
          "type": "string"
        },
        "uid": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "mode",
        "uid",
        "gid",
        "mtime"
      ],
      "type": "object"
    },
    "trashedFrom": {
      "description": "Where a trashed node came from, so it can be restored.",
      "properties": {
        "name": {
          "maxLength": 255,
          "minLength": 1,
          "type": "string"
        },
        "parent": {
          "ref": "#parent",
          "type": "ref"
        }
      },
      "required": [
        "parent",
        "name"
      ],
      "type": "object"
    }
  },
  "id": "party.whey.files.defs",
  "lexicon": 1
}
```
