Packages

Minimal request builder for S3-compatible object storage API

Current section

3 Versions

Jump to

Compare versions

6 files changed
+34 additions
-11 deletions
  @@ -1,5 +1,9 @@
1 1 # Changelog
2 2
3 + ## 0.1.1 (2025-03-27)
4 +
5 + - ensure HTTP port is set in the returned `URI.t()` from `build/1`
6 +
3 7 ## 0.1.0 (2024-03-31)
4 8
5 9 - cleanup, upadte deps, add some docs
  @@ -0,0 +1,9 @@
1 + .PHONY: help minio
2 +
3 + help:
4 + @perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
5 +
6 + minio: ## Start a transient container with a recent version of minio
7 + docker run -d --rm -p 9000:9000 -p 9001:9001 --name minio minio/minio server /data --address ":9000" --console-address ":9001"
8 + while ! docker exec minio mc alias set local http://localhost:9000 minioadmin minioadmin; do sleep 1; done
9 + docker exec minio mc mb local/testbucket
  @@ -1,8 +1,11 @@
1 + # S3
2 +
3 + [![Hex Package](https://img.shields.io/hexpm/v/s3.svg)](https://hex.pm/packages/s3)
4 + [![Hex Docs](https://img.shields.io/badge/hex-docs-blue.svg)](https://hexdocs.pm/s3)
5 +
1 6 Small and experimental Amazon S3-compatible object storage request builder.
2 7
3 - Verified to work with Amazon S3, MinIO.
4 -
5 - TODO: Wasabi, Backblaze B2, Cloudflare R2, DigitalOcean, and Scaleway.
8 + Verified to work with Amazon S3, MinIO, Cloudflare R2, and Backblaze B2.
6 9
7 10 #### Example using [MinIO](https://github.com/minio/minio) and [Finch](https://github.com/sneako/finch)
  @@ -1,13 +1,13 @@
1 1 {<<"links">>,[{<<"GitHub">>,<<"https://github.com/ruslandoga/s3">>}]}.
2 2 {<<"name">>,<<"s3">>}.
3 - {<<"version">>,<<"0.1.0">>}.
3 + {<<"version">>,<<"0.1.1">>}.
4 4 {<<"description">>,
5 5 <<"Minimal request builder for S3-compatible object storage API">>}.
6 - {<<"elixir">>,<<"~> 1.15">>}.
6 + {<<"elixir">>,<<"~> 1.16">>}.
7 7 {<<"app">>,<<"s3">>}.
8 8 {<<"licenses">>,[<<"MIT">>]}.
9 9 {<<"requirements">>,[]}.
10 10 {<<"files">>,
11 11 [<<"lib">>,<<"lib/s3.ex">>,<<".formatter.exs">>,<<"mix.exs">>,
12 - <<"README.md">>,<<"CHANGELOG.md">>]}.
13 - {<<"build_tools">>,[<<"mix">>]}.
12 + <<"README.md">>,<<"CHANGELOG.md">>,<<"Makefile">>]}.
13 + {<<"build_tools">>,[<<"mix">>,<<"make">>]}.
  @@ -32,6 +32,13 @@ defmodule S3 do
32 32 %{} = parsed -> parsed
33 33 end
34 34
35 + url =
36 + case url do
37 + %{port: port} when is_integer(port) -> url
38 + %{scheme: "http"} -> Map.put(url, :port, 80)
39 + %{scheme: "https"} -> Map.put(url, :port, 443)
40 + end
41 +
35 42 host = Keyword.get(options, :host)
36 43 path = Keyword.get(options, :path) || "/"
37 44 query = Keyword.get(options, :query) || %{}
Loading more files…