pub struct Files { /* private fields */ }Expand description
A set of files by path, or a folder of it: bytes written whole and replaced whole, each with a type, an ETag and a few strings of the program’s.
Implementations§
Source§impl Files
impl Files
Sourcepub fn folder(&self, segment: impl Key) -> Files
pub fn folder(&self, segment: impl Key) -> Files
The folder in this one that segment names: folder("users").folder(42)
is users/42, and its files’ paths are its segments and then theirs.
Sourcepub fn key(&self, path: &str) -> FileCall<'_>
pub fn key(&self, path: &str) -> FileCall<'_>
A call on one path, its options before its verb:
files.key("a.md").if_match(&etag).put(&text).
Sourcepub fn put(&self, path: &str, bytes: impl AsRef<[u8]>) -> Result<FileInfo>
pub fn put(&self, path: &str, bytes: impl AsRef<[u8]>) -> Result<FileInfo>
Writes the file and replaces whatever the path held, at the moment it returns.
Sourcepub fn create(&self, path: &str, bytes: impl AsRef<[u8]>) -> Result<bool>
pub fn create(&self, path: &str, bytes: impl AsRef<[u8]>) -> Result<bool>
Writes the file only when the path holds none; says whether it did.
Sourcepub fn upload(&self, path: &str) -> Result<Upload>
pub fn upload(&self, path: &str) -> Result<Upload>
A file written a piece at a time, which appears at its commit.
Sourcepub fn get(&self, path: &str) -> Result<Option<StoredFile>>
pub fn get(&self, path: &str) -> Result<Option<StoredFile>>
The file at the path and the bytes it reads, which stay what they were now through a replace, a delete or an expiry; none when there is none.
Sourcepub fn head(&self, path: &str) -> Result<Option<FileInfo>>
pub fn head(&self, path: &str) -> Result<Option<FileInfo>>
What the file at the path carries, none of its bytes.
Sourcepub fn delete(&self, path: &str) -> Result<()>
pub fn delete(&self, path: &str) -> Result<()>
Removes the file at the path; nothing to remove is not an error.
Sourcepub fn copy(&self, from: &str, to: &str) -> Result<FileInfo>
pub fn copy(&self, from: &str, to: &str) -> Result<FileInfo>
Writes the file at from at to too, sharing its bytes: no byte is
copied, and the two are two files from then on. A file at to is a
conflict: key(to).if_match(etag).copy_from(from) replaces the version
it names.
Source§impl Files
impl Files
Sourcepub fn list(&self) -> List<'_>
pub fn list(&self) -> List<'_>
A page of this folder’s files and of the folders in it, in the byte
order of their paths: 10.jpg before 9.jpg.
Sourcepub fn all(&self) -> All ⓘ
pub fn all(&self) -> All ⓘ
Every file of this folder and of the folders in it, a page at a time, holding nothing between pages.