| 1 | // Copyright (c) 2019-2026 Alexander Medvednikov. All rights reserved. |
| 2 | // Use of this source code is governed by an MIT license |
| 3 | // that can be found in the LICENSE file. |
| 4 | // Module s3 is an S3-compatible client for V. |
| 5 | // |
| 6 | // Quick start: |
| 7 | // |
| 8 | // import s3 |
| 9 | // |
| 10 | // client := s3.new_client(s3.Credentials{ |
| 11 | // endpoint: 'https://s3.example.com' |
| 12 | // access_key_id: '...' |
| 13 | // secret_access_key: '...' |
| 14 | // bucket: 'my-bucket' |
| 15 | // }) |
| 16 | // client.put('hello.txt', 'Hi from V!'.bytes())! |
| 17 | // text := client.get_string('hello.txt')! |
| 18 | // url := client.presign('hello.txt', expires_in: 3600)! |
| 19 | // |
| 20 | // // s3:// fetch helper: |
| 21 | // resp := s3.fetch('s3://my-bucket/hello.txt')! |
| 22 | // |
| 23 | // Construct credentials from the environment (S3_*, AWS_*, CELLAR_ADDON_*, |
| 24 | // SCW_*, B2_*, R2_*, SPACES_* — first non-empty wins per field): |
| 25 | // |
| 26 | // client := s3.new_client(s3.Credentials.from_env()) |
| 27 | // |
| 28 | // Multipart for large files: |
| 29 | // |
| 30 | // client.upload_file('big.bin', '/path/to/big.bin', s3.PutOptions{ content_type: 'application/octet-stream' })! |
| 31 | module s3 |
| 32 | |
| 33 | // version is the module version, kept in sync with v.mod. |
| 34 | pub const version = '0.1.0' |
| 35 | |
| 36 | // info_string returns a one-line build-time identification, useful in |
| 37 | // User-Agent strings or `--version` output. |
| 38 | pub fn info_string() string { |
| 39 | return 's3/${version}' |
| 40 | } |
| 41 | |