static S serveTextFile(S uri, S name) { //print("sts: " + quote(uri)); S prefix = "/download/"; if (swic(uri, prefix)) { uri = dropFirst(l(prefix), uri); //print("sts: " + quote(uri)); if (eqic(name, uri)) { S content = loadProgramTextFile(name); if (content == null) content = "<not found>"; if (empty(content)) content = "<empty>"; //print("sts content length: " + l(content)); ret htmlencode(content); // hm. content-type? } } ret null; }
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: | #1003044 |
Snippet name: | serveTextFile - serve one of current bot's files through http |
Eternal ID of this version: | #1003044/1 |
Text MD5: | 5f8ec3ed0e8cfbad77353d999db2adca |
Author: | stefan |
Category: | eleu |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-04-25 15:15:23 |
Source code size: | 512 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 512 / 488 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) |