Interface GitHubContent

Represents a file or directory entry in a GitHub repository.

interface GitHubContent {
    _links: Record<string, string>;
    content?: string;
    download_url: null | string;
    encoding?: string;
    html_url: string;
    name: string;
    path: string;
    sha: string;
    size: number;
    type: "file" | "dir" | "symlink" | "submodule";
    url: string;
}

Properties

_links: Record<string, string>

HAL links

content?: string

Base64-encoded file content. Only present for files when type is 'file'. Decode with Buffer.from(content, 'base64').toString() or atob(content).

download_url: null | string

URL to the raw file content

encoding?: string

Content encoding (only for files — always 'base64')

html_url: string

URL to this file on GitHub

name: string

Entry name (filename or directory name)

path: string

Path from repository root

sha: string

Blob SHA

size: number

File size in bytes

type: "file" | "dir" | "symlink" | "submodule"

Entry type

url: string

API URL to this content entry