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.

1  
static SS guessMimeTypeFromFileName_map = litmap(
2  
  ".css", "text/css",
3  
  ".js", "text/javascript",
4  
);
5  
6  
sS guessMimeTypeFromFileName(S name, S defaultMimeType default binaryMimeType()) {
7  
  // We do some mime types ourselves, leave the rest to the JDK function
8  
  
9  
  try answer guessMimeTypeFromFileName_map.get(fileExtension(name));
10  
  
11  
  ret or2(URLConnection.guessContentTypeFromName(name), defaultMimeType);
12  
}

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: 170 / 265
Version history: 5 change(s)
Referenced in: [show references]