Crates.io | remi-fs |
lib.rs | remi-fs |
version | |
source | src |
created_at | 2023-02-09 04:58:48.120799 |
updated_at | 2024-12-04 02:25:32.455928 |
description | ๐ปโโ๏ธ๐งถ Official and maintained remi-rs crate for support of the local filesystem |
homepage | |
repository | https://github.com/Noelware/remi-rs |
max_upload_size | |
id | 780494 |
Cargo.toml error: | TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
remi-rs
crate for support of the local filesystemCrate Features | Description | Enabled by default? |
---|---|---|
unstable |
Tap into unstable features from remi_fs and the remi crate. |
No. |
serde_json |
Uses the serde_json crate to detect JSON documents and return application/json |
No. |
serde_yaml_ng |
Allows to detect YAML documents with the serde_yaml_ng crate. |
No. |
file-format |
Uses the file-format crate to find media types on any external datatype. |
Yes. |
tracing |
Enables the use of tracing::instrument and emit events for actions by the crate. |
No. |
infer |
Uses the infer crate to infer external datatypes and map them to their media type. |
Yes. |
serde |
Enables the use of serde in StorageConfig |
No. |
log |
Emits log records for actions by the crate | No. |
// Cargo.toml:
//
// [dependencies]
// remi = "^0"
// remi-fs = "^0"
// tokio = { version = "^1", features = ["full"] }
use remi_fs::{StorageService, StorageConfig};
use remi::{StorageService as _, UploadRequest};
#[tokio::main]
async fn main() {
// Initialize a `StorageService` that uses your local filesystem for storing files.
let storage = StorageService::new("./data");
// Next, we will run the `init` function which will create
// the ./data directory if it doesn't exist already.
storage.init().await.unwrap();
// We define a `UploadRequest`, which will set the content type to `text/plain` and set the
// contents of `weow.txt` to `weow fluff`.
let upload = UploadRequest::default()
.with_content_type(Some("text/plain"))
.with_data("weow fluff");
// Let's upload it!
storage.upload("./weow.txt", upload).await.unwrap();
// Let's check if it exists! This `assert!` will panic if it failed
// to upload.
assert!(storage.exists("./weow.txt").await.unwrap());
}