Skip to content
Pre-release. HostCraft is in testing and not yet for sale. These docs describe the current build and may change. Join the waitlist to hear when it launches.

Files API

Source: daemon/proto/hostcraft/v1/files.proto

FilesService is the file manager. Every path is relative to the account's home directory and confined to it. account_id defaults to the caller's own account. REST: /api/v1/files.

Method REST route Permission Streaming
ListEntries GET /api/v1/files/list FilesList unary
GetEntry GET /api/v1/files/entry FilesRead unary
ReadFile GET /api/v1/files/read FilesRead unary
WriteFile POST /api/v1/files/write FilesWrite unary
MakeDirectory POST /api/v1/files/mkdir FilesWrite unary
DeleteEntries POST /api/v1/files/delete FilesDelete unary
MoveEntry POST /api/v1/files/move FilesMove unary
CopyEntry POST /api/v1/files/copy FilesCopy unary
Chmod POST /api/v1/files/chmod FilesChmod unary
Chown POST /api/v1/files/chown FilesChown unary
CreateArchive POST /api/v1/files/archive/create FilesArchive unary
ExtractArchive POST /api/v1/files/archive/extract FilesArchive unary
BeginUpload POST /api/v1/files/upload/begin FilesUpload unary
AppendUpload POST /api/v1/files/upload/{upload_id}/append FilesUpload unary
CompleteUpload POST /api/v1/files/upload/{upload_id}/complete FilesUpload unary
DownloadFile GET /api/v1/files/download FilesDownload unary

/hostcraft.v1.FilesService/ListEntries

/hostcraft.v1.FilesService/GetEntry

ReadFile returns a UTF-8 text range; binary files must use DownloadFile.

/hostcraft.v1.FilesService/ReadFile

/hostcraft.v1.FilesService/WriteFile

/hostcraft.v1.FilesService/MakeDirectory

/hostcraft.v1.FilesService/DeleteEntries

/hostcraft.v1.FilesService/MoveEntry

/hostcraft.v1.FilesService/CopyEntry

/hostcraft.v1.FilesService/Chmod

/hostcraft.v1.FilesService/Chown

/hostcraft.v1.FilesService/CreateArchive

/hostcraft.v1.FilesService/ExtractArchive

BeginUpload, AppendUpload and CompleteUpload are the chunked upload protocol: begin returns an upload id, append sends chunks at increasing offsets, complete verifies the optional SHA-256 and moves the file into place.

/hostcraft.v1.FilesService/BeginUpload

/hostcraft.v1.FilesService/AppendUpload

/hostcraft.v1.FilesService/CompleteUpload

DownloadFile returns the whole file in one message (up to 256 MiB; raise the client's max receive size for files over 4 MiB).

/hostcraft.v1.FilesService/DownloadFile

Field Type Number Description
upload_id string 1 -
offset int64 2 -
chunk bytes 3 -
Field Type Number Description
bytes_received int64 1 -
Field Type Number Description
account_id string 1 -
target_path string 2 -
total_size int64 3 -
mode uint32 4 -
overwrite bool 5 -
Field Type Number Description
upload_id string 1 -
chunk_size_hint int64 2 -
Field Type Number Description
account_id string 1 -
path string 2 -
mode uint32 3 -
recursive bool 4 -
Field Type Number Description
account_id string 1 -
path string 2 -
user string 3 -
group string 4 -
recursive bool 5 -
Field Type Number Description
upload_id string 1 -
sha256_hex string 2 -
Field Type Number Description
account_id string 1 -
from string 2 -
to string 3 -
overwrite bool 4 -
recursive bool 5 -
Field Type Number Description
account_id string 1 -
paths repeated string 2 -
format string 3 zip | tar | tar_gz
output_path string 4 -
overwrite bool 5 -
Field Type Number Description
entry FileEntry 1 -
size_bytes int64 2 -
Field Type Number Description
account_id string 1 -
paths repeated string 2 -
recursive bool 3 -
Field Type Number Description
deleted_count int64 1 -
Field Type Number Description
account_id string 1 -
path string 2 -
Field Type Number Description
content bytes 1 -
Field Type Number Description
account_id string 1 -
path string 2 -
target_dir string 3 -
overwrite bool 4 -
Field Type Number Description
extracted_count int64 1 -
target_dir string 2 -
Field Type Number Description
path string 1 -
name string 2 -
kind string 3 file | directory | symlink
size_bytes int64 4 -
mode uint32 5 -
owner string 6 -
group string 7 -
modified_at google.protobuf.Timestamp 8 -
symlink_target string 9 -
is_hidden bool 10 -
Field Type Number Description
entry FileEntry 1 -
Field Type Number Description
account_id string 1 -
path string 2 -
Field Type Number Description
account_id string 1 -
path string 2 default /
recursive bool 3 -
glob string 4 -
Field Type Number Description
entries repeated FileEntry 1 -
Field Type Number Description
account_id string 1 -
path string 2 -
mode uint32 3 -
parents bool 4 -
Field Type Number Description
account_id string 1 -
from string 2 -
to string 3 -
overwrite bool 4 -
Field Type Number Description
account_id string 1 -
path string 2 -
offset int64 3 -
length int64 4 -
Field Type Number Description
content string 1 -
total_size_bytes int64 2 -
eof bool 3 -
Field Type Number Description
account_id string 1 -
path string 2 -
content string 3 -
mode uint32 4 -
create_only bool 5 -