Operator
The entry class for all public blocking APIs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scheme
|
str
|
The service name that OpenDAL supports. |
required |
**options
|
any
|
The options for the service. See the documentation of each service for more details. |
{}
|
Example
1 2 3 |
|
capability()
#
Get the capability of the operator.
Returns:
Type | Description |
---|---|
Capability
|
The capability of the operator. |
copy(source, target)
#
Copy the object from source to target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source
|
str | Path
|
The source path. |
required |
target
|
str | Path
|
The target path. |
required |
create_dir(path)
#
Create a directory at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the directory. |
required |
delete(path)
#
Delete the object at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the object. |
required |
exists(path)
#
Check if the object at the given path exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the object. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the object exists, False otherwise. |
layer(layer)
#
Add new layers upon the current operator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer
|
Layer
|
The layer to be added. |
required |
Returns:
Type | Description |
---|---|
Operator
|
The new operator with the layer added. |
list(path)
#
List the objects at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the directory. |
required |
Returns:
Type | Description |
---|---|
Iterable[Entry]
|
An iterable of entries representing the objects in the directory. |
open(path, mode)
#
Open a file at the given path for reading or writing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the file. |
required |
mode
|
str
|
The mode to open the file. Can be "rb" or "wb". |
required |
Returns:
Type | Description |
---|---|
File
|
A file-like object that can be used to read or write the file. |
Example
1 2 3 4 |
|
read(path)
#
Read the content of the object at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the object. |
required |
Returns:
Type | Description |
---|---|
bytes
|
The content of the object as bytes. |
remove_all(path)
#
Remove all objects at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the directory. |
required |
rename(source, target)
#
Rename the object from source to target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source
|
str | Path
|
The source path. |
required |
target
|
str | Path
|
The target path. |
required |
scan(path)
#
Scan the objects at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the directory. |
required |
Returns:
Type | Description |
---|---|
Iterable[Entry]
|
An iterable of entries representing the objects in the directory. |
stat(path)
#
Get the metadata of the object at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the object. |
required |
Returns:
Type | Description |
---|---|
Metadata
|
The metadata of the object. |
write(path, bs, *, append=..., chunk=..., content_type=..., content_disposition=..., cache_control=...)
#
Write the content to the object at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
The path to the object. |
required |
bs
|
bytes
|
The content to write. |
required |
append
|
bool
|
Whether to append the content to the object. Defaults to False. |
...
|
chunk
|
int
|
The chunk size for writing. Defaults to write all. |
...
|
content_type
|
str
|
The content type of the object. Defaults to None. |
...
|
content_disposition
|
str
|
The content disposition of the object. Defaults to None. |
...
|
cache_control
|
str
|
The cache control of the object. Defaults to None. |
...
|