class Shrine::Storage::S3
- Shrine::Storage::S3
- Shrine::Storage::Base
- Reference
- Object
Defined in:
shrine/storage/s3.crConstructors
-
.new(bucket : String, client : Awscr::S3::Client?, prefix : String? = nil, upload_options : Hash(String, String) = Hash(String, String).new, public : Bool = false)
Initializes a storage for uploading to S3.
Instance Method Summary
- #bucket : String
- #clean(path)
- #client : Awscr::S3::Client
-
#delete(id : String) : Bool
Delets the file, and by default deletes the containing directory if it's empty.
-
#exists?(id : String) : Bool
Returns true if the file exists on the S3.
-
#object_key(id : String) : String
Returns object key with potential prefix.
-
#open(id : String, **options) : IO
Returns a IO object from S3
- #path(id : String)
- #public? : Bool
- #upload(io : IO | UploadedFile, id : String, metadata : Shrine::UploadedFile::MetadataType, move = false, **upload_options)
-
#upload(io : IO | UploadedFile, id : String, move = false, **upload_options)
Copies the file into the given location.
-
#url(id : String, **options) : String
Returns the presigned URL to the file.
Instance methods inherited from class Shrine::Storage::Base
clean(path : String)
clean,
clean? : Bool
clean?,
delete(id : String)
delete,
exists?(id : String) : Bool
exists?,
open(id : String, **options) : IO
open,
upload(io : IO | UploadedFile, id : String, move = false, **options)
upload,
url(id : String, **options) : String
url
Constructor Detail
Initializes a storage for uploading to S3. All options are forwarded to
[Shrine::Storage::S3#initialize
], except the following:
:bucket : (Required). Name of the S3 bucket.
:client
: By default an Awscr::S3::Client
instance is created internally from
additional options, but you can use this option to provide your own
client.
:prefix : "Directory" inside the bucket to store files into.
:upload_options : Additional options that will be used for uploading files.
:public : Sets public access to all uploading files.
Instance Method Detail
Delets the file, and by default deletes the containing directory if it's empty.
Copies the file into the given location.