singlestoredb.management.workspace.FilesObject¶
- class singlestoredb.management.workspace.FilesObject(name: str, path: str, size: int, type: str, format: str, mimetype: str, created: datetime | None, last_modified: datetime | None, writable: bool, content: List[str] | None = None)¶
File / folder object.
It can belong to either a workspace stage or personal/shared space.
This object is not instantiated directly. It is used in the results of various operations in
WorkspaceGroup.stage,FilesManager.personal_space,FilesManager.shared_spaceandFilesManager.models_spacemethods.- __init__(name: str, path: str, size: int, type: str, format: str, mimetype: str, created: datetime | None, last_modified: datetime | None, writable: bool, content: List[str] | None = None)¶
Methods
__init__(name, path, size, type, format, ...)abspath()Return the full path of the object.
basename()Return the basename of the object.
dirname()Return the directory name of the object.
download([local_path, overwrite, encoding])Download the content of a file path.
download_file([local_path, overwrite, encoding])Download the content of a file path.
exists()Does the file / folder exist?
from_dict(obj, location)Construct a FilesObject from a dictionary of values.
getctime()Return the creation datetime as a UNIX timestamp.
getmtime()Return the last modified datetime as a UNIX timestamp.
is_dir()Is the object a directory?
is_file()Is the object a file?
open([mode, encoding])Open a file path for reading or writing.
remove()Delete the file.
Delete the directory recursively.
rename(new_path, *[, overwrite])Move the file to a new location.
rmdir()Delete the empty directory.
Attributes
nameName of file / folder
pathPath of file / folder
sizeSize of the object (in bytes)
typefile or directory
formatData format
mimetypeMime type
created_atDatetime the object was created
last_modified_atDatetime the object was modified last
writableIs the object writable?
contentContents of a directory