Sha256: 5b8efb9741e79433e846b52ab78cc589503034c592ec221bc9adf4eea342b8b6
Contents?: true
Size: 671 Bytes
Versions: 4
Compression:
Stored size: 671 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 # Sample URI: s3://mybucket/user/abc.zip def self.parse_uri(uri) # 's3://mybucket/user/abc.zip' uri = URI.parse(uri) # Filename and bucket only if uri.scheme.nil? segments = uri.path.split('/') raise "S3 URI must at the very least contain '<bucket_name>/<key>'" if (segments.size == 1) || (segments[0] == '') { bucket: segments.shift, key: segments.join('/') } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
iostreams-0.16.2 | lib/io_streams/s3.rb |
iostreams-0.16.1 | lib/io_streams/s3.rb |
iostreams-0.16.0 | lib/io_streams/s3.rb |
iostreams-0.15.0 | lib/io_streams/s3.rb |