racket/collects/little-helper/web-root/servlets/private/mime.scm
2008-03-01 13:55:04 +00:00

22 lines
655 B
Scheme

(module mime mzscheme
(provide get-mime-type
text-mime-type?)
(require (lib "dirs.ss" "setup")
(lib "private/mime-types.ss" "web-server"))
; get-mime-type : path -> string
(define get-mime-type
(let ([path->mime-type
(make-path->mime-type
(build-path (find-collects-dir)
"web-server" "default-web-root" "mime.types"))])
(lambda (file)
(path->mime-type
(if (string? file)
(string->path file)
file)))))
(define (text-mime-type? file-path)
(regexp-match #rx"^text"
(get-mime-type file-path))))