Module: Hydra::PCDM::GetMimeTypeForFile
- Defined in:
- lib/hydra/pcdm/services/file/get_mime_type.rb
Class Method Summary collapse
Class Method Details
.call(path) ⇒ Object
3 4 5 6 7 |
# File 'lib/hydra/pcdm/services/file/get_mime_type.rb', line 3 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 |