るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.053秒)
トップページ > クエリ:String[x] > クエリ:mime_type[x]

別のキーワード

  1. httputils mime_type
  2. httputils load_mime_types
  3. webrick/httputils mime_type
  4. webrick/httputils load_mime_types
  5. mime_type webrick/httputils

ライブラリ

モジュール

検索結果

WEBrick::HTTPUtils.#mime_type(filename, mime_tab) -> String (18220.0)

ファイル名 filename の拡張子をもとにその MIME タイプを指定された mime_tab から探して文字列として返します。MIME タイプが見つからない場合は "application/octet-stream" を返します。

...ハッシュを指定します。

require 'webrick'
include WEBrick::HTTPUtils
p mime_type('index.html', DefaultMimeTypes) #=> "text/html"
p mime_type('index.html.ja', DefaultMimeTypes) #=> "text/html"
p mime_type('index.hoge', DefaultMimeTypes) #=> "application/octet-stream"...