{"id":28570120,"url":"https://github.com/wallarm/cloud_storage","last_synced_at":"2026-02-12T17:06:41.757Z","repository":{"id":45052356,"uuid":"348792796","full_name":"wallarm/cloud_storage","owner":"wallarm","description":"Very simple wrapper for cloud storages (gcs, s3),","archived":false,"fork":false,"pushed_at":"2022-09-29T18:06:28.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-21T21:06:28.137Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/wallarm.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":"2021-03-17T17:19:22.000Z","updated_at":"2021-10-21T06:04:00.000Z","dependencies_parsed_at":"2023-01-18T16:26:50.641Z","dependency_job_id":null,"html_url":"https://github.com/wallarm/cloud_storage","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/wallarm/cloud_storage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallarm%2Fcloud_storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallarm%2Fcloud_storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallarm%2Fcloud_storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallarm%2Fcloud_storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wallarm","download_url":"https://codeload.github.com/wallarm/cloud_storage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallarm%2Fcloud_storage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279032711,"owners_count":26089387,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10T17:40:07.250Z","updated_at":"2025-10-15T00:54:56.469Z","avatar_url":"https://github.com/wallarm.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CloudStorage\n\nVery simple wrapper for cloud storages (gcs, s3), methods:\n\n- list files\n- download file\n- file exist?\n- upload file\n- signed url\n- delete file\n\n## Installation\n\nAdd to your Gemfile:\n\n```ruby\ngem 'cloud_storage'\n```\n\nGcs wrapper requires [google-cloud-storage](https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-storage) gem\u003cbr\u003e\nS3 wrapper requires [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby)\n\n## client\n\ngcs example:\n\n```ruby\nrequire 'cloud_storage/wrappers/gcs'\n\ncli = CloudStorage::Client.new(\n  :gcs,\n  bucket: 'some-bucket',\n  project_id: 'some-project-id',\n  credentials: 'secrets/some-secrets.json',\n  # endpoint: 'http://gcs:8080/'\n)\n```\n\ns3 (Aws, Yandex, Minio) example:\n\n```ruby\nrequire 'cloud_storage/wrappers/s3'\n\ncli = CloudStorage::Client.new(\n  :s3,\n  bucket: 'some-bucket',\n  endpoint: 'http://s3:4569', # https://storage.yandexcloud.net\n  region: 'RU',\n  access_key_id: 'some-id',\n  secret_access_key: 'some-secret'\n)\n```\n\n### list files (enumerable):\n\n```ruby\n\u003e cli.files(prefix: 'some_dir').map { |f| [f.name, f.size] }\n=\u003e [[\"some_dir/test.txt\", 22]]\n```\n\n### delete file:\n\n```ruby\n\u003e f = cli.files.first\n\u003e f.delete!\n=\u003e nil\n```\n\n### delete files:\n\n```ruby\n\u003e cli.delete_files(['some_dir/test1.txt', 'some_dir/test2.txt'])\n```\n\n### check file:\n\n```ruby\n\u003e cli.exist?('test.txt')\n=\u003e false\n```\n\n### upload file:\n\n```ruby\n\u003e f = cli.upload_file(key: 'test.txt', file: File.open('test.txt', 'rb'))\n\u003e f.name\n=\u003e 'test.txt'\n\n\u003e stream = StringIO.new('test')\n\u003e f = cli.upload_file(key: 'test.txt', file: stream)\n\u003e f.name\n=\u003e 'test.txt'\n```\n\n### signed url:\n\n`expires_in` - seconds, optional. You can also pass any arg specific for a gcs or s3 client:\n\n```ruby\n# gcs\n\u003e key = OpenSSL::PKey::RSA.new(File.read('dummy.key'))\n\u003e f.signed_url(expires: 10, issuer: 'max@tretyakov-ma.ru', signing_key: key)\n=\u003e \"https://storage.googleapis.com/some-bucket/test.txt?GoogleAccessId=max%40tretyakov-ma.ru\u0026Expires=1615375291\u0026Signature=FIwtDC%2FkURL%2F9JaKOWmqXgTbvdtilQH4Wsf18rPfLvn1eg6zqZ1pjY4PB82D82Spo5iQbepwnE5OozGxL0B3sliZPcut67kPulCnEXz8IRvbeJ4VY2kFXMg0KThyrZwXhF3kHu7YiKQn8tcf6NmHrKEjKNeioAcO4fnbm8f9k7AlhpwOhQayTzHceSqJlxty7M7stLbSezh7CxEV%2F1M8oTvreg57t3J%2FPG9qhtWrPZoKJS1tScpFQpWH%2F5SiCdyn56WLYf4XKpyHx3%2FaBDBvlYsWB8cRWCFPnuSPif8ePkEI2pZDaG%2FNTW0X%2BhGEWcp6Db4VnbB1s%2BK0mhUxNy8ATg%3D%3D\"\n\n# s3\n\u003e f.signed_url(expires_in: 10)\n=\u003e \"http://wallarm-devtmp-ipfeeds-presigned-urls-research.s3:4569/Gemfile?X-Amz-Algorithm=AWS4-HMAC-SHA256\u0026X-Amz-Credential=...\u0026X-Amz-Date=20210310T061122Z\u0026X-Amz-Expires=10\u0026X-Amz-SignedHeaders=host\u0026X-Amz-Signature=...\"\n```\n\n### Download\n\n```ruby\n\u003e cli.find('test.txt').download.read\n=\u003e \"This is a test download\\n\"\n\ns = StringIO.new\n\u003e cli.find('test.txt').download(s)\n\u003e s.read\n=\u003e \"This is a test download\\n\"\n```\n\n```ruby\n\u003e f = cli.files.first\n\u003e f.download.read\n=\u003e \"This is a test download\\n\"\n```\n\n### Find\n\n```ruby\n\u003e cli.find('test.txt').to_s\n=\u003e \"#\u003cCloudStorage::Objects::S3:0x00007f778ed685c8\u003e\"\n```\n\nSee the specs for more examples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwallarm%2Fcloud_storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwallarm%2Fcloud_storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwallarm%2Fcloud_storage/lists"}