gcs-crest

gcs-crest

gcs-crest is a lightweight, high-performance Google Cloud Storage (GCS) client written in Crystal. Powered by mamantoha/crest HTTP REST client and Google Cloud Service Account OAuth2 token authentication, it provides seamless object storage management for cloud-native Crystal applications.

Features

  • Google Cloud Storage Integration: Upload, retrieve, and delete objects in GCS buckets via REST APIs.
  • Service Account Authentication: Automatic OAuth2 bearer token acquisition and caching from Service Account JSON credentials or GCP metadata servers.
  • Streamlined HTTP Client: Built on Crest for fast, efficient HTTP multipart and binary payloads.
  • GPLv3 Licensed: Released under the GNU General Public License v3.0.

Official Repository

The official repository for gcs-crest is hosted on GitLab: https://gitlab.com/renich/gcs-crest

Installation

Add gcs-crest to your shard.yml:

dependencies:
  gcs-crest:
    gitlab: renich/gcs-crest
    version: ~> 0.1.0

Run shards install.

Usage

1. Initialize Client

require "gcs-crest"

# Initialize GCS client using environment bucket or explicit parameter
client = GCS::Client.new(bucket: ENV["GCS_BUCKET_NAME"])

2. Upload File Object

file_content = File.read("avatar.png")
response = client.upload(
  path: "avatars/user-123.png",
  content: file_content,
  content_type: "image/png"
)

puts "Upload status: #{response.status_code}"

3. Read Object

object_data = client.read("avatars/user-123.png")
File.write("downloaded_avatar.png", object_data)

Running Specs

crystal spec

License

GNU General Public License v3.0 (GPL-3.0-or-later). See LICENSE for details.

Author

Created and maintained by Rénich Bon Ćirić (renich@woralelandia.com).

Repository

gcs-crest

Owner
Statistic
  • 0
  • 0
  • 0
  • 2
  • 1
  • 1 day ago
  • July 21, 2026
License

GNU General Public License v3.0 only

Links
Synced at

Tue, 21 Jul 2026 08:58:57 GMT

Languages