flysystem

Crates.ioflysystem
lib.rsflysystem
version0.2.1
sourcesrc
created_at2023-12-18 02:13:03.007052
updated_at2024-12-10 15:18:11.72132
descriptionA filesystem abstraction layer for Rust.
homepage
repositoryhttps://github.com/m1guelpf/flysystem
max_upload_size
id1072886
size72,783
Miguel Piedrafita (m1guelpf)

documentation

README

Flysystem

A filesystem abstraction layer for Rust.

crates.io download count badge docs.rs

About Flysystem

Flysystem is a file storage library for Rust. It provides one interface to interact with many types of filesystems. When you use Flysystem, you're not only protected from vendor lock-in, you'll also have a consistent experience for which ever storage is right for you.

It's inspired by the PHP library of the same name.

Getting Started

use flysystem::{Filesystem, adapters::{S3Adapter, s3::Config}};

// instantly swap between storage backends
// (like S3/FTP/etc) by changing the type 👇👇👇 here.
let mut filesystem = Filesystem::new::<S3Adapter>(Config {
    region: env::var("S3_REGION").ok(),
    bucket: env::var("S3_BUCKET").unwrap(),
    endpoint: env::var("S3_ENDPOINT").unwrap(),
    access_key: env::var("S3_ACCESS_KEY").unwrap(),
    secret_key: env::var("S3_SECRET_KEY").unwrap(),
}).await?;

filesystem.write(Path::new("my-first-file.txt"), "Hello, world!").await?;

Refer to the documentation on docs.rs for detailed usage instructions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 6

cargo fmt