Sha256: 8d93da4279f65abb4a097017cb0ade473ed5f14e3d661991945f7d2436cef827
Contents?: true
Size: 332 Bytes
Versions: 2
Compression:
Stored size: 332 Bytes
Contents
module Hydra::PCDM class GetMimeTypeForFile def self.call(path) raise ArgumentError, 'supplied argument should be a path to a file' unless path.is_a?(String) mime_types = ::MIME::Types.of(::File.basename(path)) mime_types.empty? ? 'application/octet-stream' : mime_types.first.content_type end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hydra-pcdm-0.5.0 | lib/hydra/pcdm/services/file/get_mime_type.rb |
hydra-pcdm-0.4.0 | lib/hydra/pcdm/services/file/get_mime_type.rb |