{"id":28498309,"url":"https://github.com/yanganto/s3handler","last_synced_at":"2025-07-03T13:31:41.008Z","repository":{"id":37883037,"uuid":"169823065","full_name":"yanganto/s3handler","owner":"yanganto","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-07T09:24:00.000Z","size":194,"stargazers_count":3,"open_issues_count":6,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-08T13:43:39.343Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yanganto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-09T02:09:54.000Z","updated_at":"2021-11-15T01:06:52.000Z","dependencies_parsed_at":"2023-02-19T16:10:20.722Z","dependency_job_id":null,"html_url":"https://github.com/yanganto/s3handler","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/yanganto/s3handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanganto%2Fs3handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanganto%2Fs3handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanganto%2Fs3handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanganto%2Fs3handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yanganto","download_url":"https://codeload.github.com/yanganto/s3handler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanganto%2Fs3handler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263335370,"owners_count":23450826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-08T13:37:11.595Z","updated_at":"2025-07-03T13:31:41.000Z","avatar_url":"https://github.com/yanganto.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# S3handler\n[![Lint Code Base](https://github.com/yanganto/s3handler/actions/workflows/linter.yml/badge.svg)](https://github.com/yanganto/s3handler/actions/workflows/linter.yml)\n[![Build \u0026 Test](https://github.com/yanganto/s3handler/actions/workflows/test.yml/badge.svg)](https://github.com/yanganto/s3handler/actions/workflows/test.yml)\n\n\nA s3 handler library for [s3rs](https://github.com/yanganto/s3rs) and [nu-shell s3 plugin](https://github.com/nushell/nushell/tree/main/crates/nu_plugin_s3)\nHere is the [document](https://docs.rs/s3handler/).\n\n\n## Blocking API is ready\n\nuse s3handler = { features = [\"blocking\"] }\n\n```rust\nlet config = s3handler::CredentialConfig{\n    host: \"s3.us-east-1.amazonaws.com\".to_string(),\n    access_key: \"akey\".to_string(),\n    secret_key: \"skey\".to_string(),\n    user: None,\n    region: None, // default will be treated as us-east-1\n    s3_type: None, // default will try to config as AWS S3 handler\n    secure: None, // dafault is false, because the integrity protect by HMAC\n};\nlet mut handler = s3handler::Handler::from(\u0026config);\nlet _ = handler.la();\n```\n\n## Async API\nBasic CRUD is implemented, other advance features are under developing.\nadd this dependency to your cargo.toml\n`s3handler = { features = [\"tokio-async\"] }`\n\nDownload a file with async api\nuse s3handler = { features = [\"tokio-async\"] }\n```rust\n// Public resource\nlet s3_pool = s3handler::none_blocking::primitives::S3Pool::new(\"somewhere.in.the.world\".to_string());\nlet obj = s3_pool.bucket(\"bucket_name\").object(\"objcet_name\");\nasync {\n    obj.download_file(\"/path/to/save/a/file\").await;\n};\n\n```\n\nS3 async handler to manipulate objects and buckets.\nThis treat all data as pool and create a canal to bridge two pool.\nIt is easy to management and sync data from folder to S3, S3 to S3, event folder to folder.\n\n\u003e\u003e\u003e\n       +------+\n       | Pool | (UpPool)  modify by `from_*` api\n       +------+\n         |  ^\n    Pull |  | Push\n         v  |\n       +------+\n       | Pool | (DownPool) modify by `toward_*` api\n       +------+\n\u003e\u003e\u003e\n\n```rust\nuse s3handler::none_blocking::traits::DataPool;\n\n// Resource with AWS version 2 auth\nlet s3_pool = s3handler::none_blocking::primitives::S3Pool::new(\"somewhere.in.the.world\".to_string())\n        .aws_v2(\"access-key\".to_string(), \"secrete-key\".to_string());\nlet bucket = s3_pool.bucket(\"bucket_name\");\n// Actually the bucket is a unconnnected canal\nassert!(!bucket.is_connect());\nlet canal = bucket.toward(\"/path/to/another/folder\").unwrap();\n// The canal bridges the two folder and ready to transfer data between bucket and folder\nassert!(canal.is_connect());\ncanal.sync().await;\n\nlet s3_pool = S3Pool::new(env::var(\"S3_HOST\").unwrap()).aws_v4(\n    akey.to_string(),\n    env::var(\"SECRET_KEY\").unwrap(),\n    env::var(\"REGION\").unwrap(),\n);\nlet mut object_list = s3_pool\n    .bucket(\u0026env::var(\"BUCKET_NAME\").unwrap())\n    .list()\n    .await\n    .unwrap();\nlet obj = object_list.next_object().await.unwrap();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanganto%2Fs3handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyanganto%2Fs3handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanganto%2Fs3handler/lists"}