Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1030485 // guessMimeTypeFromFileName

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (2809L) is out of date.

static SS guessMimeTypeFromFileName_map = litmap(
  ".css", "text/css",
  ".js", "text/javascript",
);

sS guessMimeTypeFromFileName(S name, S defaultMimeType default binaryMimeType()) {
  // We do some mime types ourselves, leave the rest to the JDK function
  
  try answer guessMimeTypeFromFileName_map.get(fileExtension(name));
  
  ret or2(URLConnection.guessContentTypeFromName(name), defaultMimeType);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030485
Snippet name: guessMimeTypeFromFileName
Eternal ID of this version: #1030485/6
Text MD5: c774d93871be8602981a52bdc3ed6e76
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-28 04:19:06
Source code size: 421 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 171 / 266
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)