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_space
andFilesManager.models_space
methods.- __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
name
Name of file / folder
path
Path of file / folder
size
Size of the object (in bytes)
type
file or directory
format
Data format
mimetype
Mime type
created_at
Datetime the object was created
last_modified_at
Datetime the object was modified last
writable
Is the object writable?
content
Contents of a directory