TypeScript API / laikacms/storage/github-cdn / GithubCdnDataSource
Class: GithubCdnDataSource
Constructors
Constructor
ts
new GithubCdnDataSource(opts): GithubCdnDataSource;Parameters
| Parameter | Type |
|---|---|
opts | GithubCdnDataSourceOptions |
Returns
GithubCdnDataSource
Methods
getFileContents()
ts
getFileContents(relativePath): Promise<LaikaResult<{
content: string;
path: string;
sha: string;
}>>;Fetch a file's content from the CDN plus a computed git blob sha.
Parameters
| Parameter | Type |
|---|---|
relativePath | string |
Returns
Promise<LaikaResult<{ content: string; path: string; sha: string; }>>
getFileMeta()
ts
getFileMeta(relativePath): Promise<LaikaResult<{
createdAt: Date;
sha: string;
updatedAt: Date;
}>>;Metadata for a file. Existence is resolved from the file tree. Timestamps are always epoch(0). The sha depends on the GithubCdnDataSourceOptions.fetchMeta flag.
Parameters
| Parameter | Type |
|---|---|
relativePath | string |
Returns
Promise<LaikaResult<{ createdAt: Date; sha: string; updatedAt: Date; }>>
listDirectory()
ts
listDirectory(relativePath): Promise<LaikaResult<GithubDirEntry[]>>;List immediate children of a directory. Empty array when the directory is missing or empty.
Parameters
| Parameter | Type |
|---|---|
relativePath | string |
Returns
Promise<LaikaResult<GithubDirEntry[]>>
pathType()
ts
pathType(relativePath): Promise<"dir" | "file">;Distinguish file vs dir. Throws NotFoundError for missing paths (mirrors GithubDataSource).
Parameters
| Parameter | Type |
|---|---|
relativePath | string |
Returns
Promise<"dir" | "file">