all repos — litestore @ a3dd540952bc22fe0e0662d0a97e091a39896b61

A minimalist nosql document store.

contenttypes.nim

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
import mimetypes, strutils

let CONTENT_TYPES* = newMimetypes()

proc isBinary*(ct: string): bool =
  if ct.endsWith "xml":
    return false
  elif ct.endsWith "html":
    return false
  elif ct.endsWith "json":
    return false
  elif ct.endsWith "script":
    return false
  elif ct.endsWith "sql":
    return false
  elif ct.startsWith "audio/":
    return true
  elif ct.startsWith "image/":
    return true
  elif ct.startsWith "message/":
    return true
  elif ct.startsWith "model/":
    return true
  elif ct.startsWith "multipart/":
    return true
  elif ct.startsWith "text/":
    return false
  elif ct.startsWith "video/":
    return true
  else:
    return true

proc isTextual*(ct: string): bool =
  return not ct.isBinary