Libraryless. Click here for Pure Java version (5158L/36K).
ifdef NoNanoHTTPD static virtual NanoHTTPD.Response serveFile(File file) { ret subBot_serveFile(file); } static virtual NanoHTTPD.Response serveFile(File file, S mimeType) { ret subBot_serveFile(file, mimeType); } endifdef ifndef NoNanoHTTPD static NanoHTTPD.Response serveFile(File file) { ret serveFile(file, "application/octet-stream"); } static NanoHTTPD.Response serveFile(File file, S mimeType) ctex { ret NanoHTTPD.newFixedLengthResponse(NanoHTTPD.Status.OK, mimeType, newFileInputStream(file), file.length()); } endifndef
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003197 |
Snippet name: | serveFile - serve a file within serveHttp |
Eternal ID of this version: | #1003197/8 |
Text MD5: | f82ffd8a9f222cc9a8e5a827c748a2fc |
Transpilation MD5: | eb6dcecb0385a8fdf43db7eef77187e6 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-11 16:45:18 |
Source code size: | 558 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 772 / 771 |
Version history: | 7 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1007545 - serveByteArray - serve a byte array with a specific content type within serveHttp #1007563 - serveFile_maxCache - serve a file within serveHttp with maximum caching #1013807 - serveFileWithName #1021738 - serveTextFileAsUTF8 #1032341 - servePartialContent |