Sha256: 2275df4b0c1d6d6783c7ed50bb3e2e37edae8142328303eff17bf8155dfe828b

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

begin
  require 'aws-sdk-s3'
rescue LoadError => exc
  raise(LoadError, "Install gem 'aws-sdk-s3' to read and write AWS S3 files: #{exc.message}")
end

require 'uri'
module IOStreams
  module S3
    autoload :Reader, 'io_streams/s3/reader'
    autoload :Writer, 'io_streams/s3/writer'

    # Sample URI: s3://mybucket/user/abc.zip
    def self.parse_uri(uri)
      uri = URI.parse(uri)
      raise "Invalid URI. Required Format: 's3://<bucket_name>/<key>'" unless uri.scheme == 's3'
      {
        bucket: uri.host,
        key: uri.path.sub(/\A\//, '')
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iostreams-0.17.0 lib/io_streams/s3.rb