|
3 | 3 |
|
4 | 4 | <!DOCTYPE html> |
5 | 5 |
|
| 6 | + |
6 | 7 | <html lang=en> |
7 | 8 |
|
8 | 9 | <head> |
|
14 | 15 |
|
15 | 16 | <meta name=description content=''> |
16 | 17 |
|
17 | | - <base href='https://ext-code.com/libs/js/io/file-server/'> |
18 | | - <link rel=canonical href='https://ext-code.com/libs/js/io/file-server/file-server.html'> |
| 18 | + <base href='https://ext-code.com/code/nodejs/server/file-server/file-server.html'> |
| 19 | + <link rel=canonical href='https://ext-code.com/code/nodejs/server/file-server/file-server.html'> |
19 | 20 |
|
20 | 21 | <meta name=viewport content='width=device-width, initial-scale=1'> |
21 | | - <link rel=icon href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAABAlBMVEVHcEzwShbtTxrzbhXyoSHyORLyTRPzXxTzZxXzqB/upCjyRRP0ixfpOB31qBnyTxTvOBTtMBX1nhjxLBH1phr0nhvwMBPtNxb0hhfubRzzeBbyaxjxbBr0jBr0hRnyQhP0jhfzlBzzrB70gxbxPRP0kxjypiD0rBz0mRnzox/uKhLzfhjzoR3xPRPzmRn0kxjvKhPwMhL1oxnwMxP1oxryWBXyeRnxXRfzfRbyfhryVxXycxfybRjwchrzbRXxeBnyaRjzchbyYxbzYhXxXxfzaBbtKxTuKhP0qx3zrB7xZhrxZhn1pRjxMBHzUhPyRRP0jhf0iBf0kxf1mRj0gxb0fRW9Ofp/AAAATHRSTlMAHxH+EP3g/f42CIF/CPZ/izb89ruLuyjgG/x/Ux8f3+AeWoDO3yB4ziV4eyuzs4JL6+vQ0HtYWOUk5dGMRfFnjOjR6GjxWlpLS0VFZBEF4QAAATVJREFUKM+tk9eygjAURaWJoFgREOy9997rrYD9/3/lwsCEBJ/ujDztlcXsk4TB43nHg3frH5wVuc96F0dtRIhpsYidjShEYCsONK0nYBZgQk/TBiKkwxQVFkEhLpoMDS5SLQ5u41pU0RmPZc5+dC/+cwZztPdVe2Gth1Ad0v+h5/oI1SN97ugjTU9QPaHpo32qX+VA7xOoTuzpg/Jjnm3r8/lOSfc3SJ6M5a0RlgRBrF/12lhemuUrZUcs3OULYqes7IvbyPIY1WNZ3gCYTZ8NVDee0xmAtPQooLrwkNIAUtI1gOrAFdbZi1tfsikAudKtg+rOrZQDQFbvbRa2bPteJR2MR6PxJmCyaTL0dm2oqn2+bEGZ76vqsAa3MXxQDTJ2NiLPoHshvyp5ezybr3yTb/m3/gB3/SLZj0tcfgAAAABJRU5ErkJggg=='> |
22 | | - |
23 | 22 |
|
24 | 23 |
|
25 | | - <script src='https://libs.ext-code.com/js/dom/component/component.js'></script> |
26 | | - <script src='https://libs.ext-code.com/js/dom/init-hdr/init-hdr.js'></script> |
| 24 | + <script src='https://libs.ext-code.com/js/dom/component/v3.0/component.js?hdr'></script> |
27 | 25 |
|
28 | 26 | <script> |
29 | 27 |
|
30 | | - |
31 | | - function start(){ |
32 | | - debug('start'); |
33 | | - initdom(); |
| 28 | + var path = 'nodejs/servers/file-server/'; |
| 29 | + var filename = 'file-server.js'; |
| 30 | + var date = '2026-02-18'; |
| 31 | + var files = { |
| 32 | + 'source' : { |
| 33 | + 'latest' : null, |
| 34 | + }, |
| 35 | + 'examples' : { |
| 36 | + }, |
| 37 | + }; |
| 38 | + |
| 39 | + |
| 40 | + mod.stack.push(ready2); |
| 41 | + |
| 42 | + function ready2(){ |
| 43 | + console.log('ready2'); |
| 44 | + btn.download.complete = async function(){ |
| 45 | + |
34 | 46 |
|
35 | | - }//start |
| 47 | + var {create_archive} = await import('https://code.ext-code.com/nodejs/servers/file-server/create-archive.m.js'); |
| 48 | + create_archive(); |
| 49 | + |
| 50 | + }//complete |
| 51 | + |
| 52 | + }//ready2 |
36 | 53 |
|
37 | 54 |
|
38 | 55 | </script> |
39 | 56 |
|
40 | | - <style> |
41 | | - |
42 | | - html |
43 | | - {font-family:arial} |
44 | | - |
45 | | - |
46 | | - #hdr |
47 | | - {display:flex;justify-content:space-between} |
48 | | - #hdr>div:first-of-type |
49 | | - {display:flex;gap:20px} |
50 | | - |
51 | | - code |
52 | | - {display:block;white-space:pre;font-family:monospace;margin:20px;padding:20px;background:whitesmoke} |
53 | | - |
54 | | - |
55 | | - |
56 | | - web-editor |
57 | | - {display:block;height:200px;margin:20px;border:1px solid lightgray;padding:10px} |
58 | | - |
59 | | - |
60 | | - input |
61 | | - {font-size:16px;padding:5px 10px} |
62 | | - input[type=button] |
63 | | - {cursor:pointer} |
64 | | - |
65 | | - |
66 | | - </style> |
67 | | - |
68 | 57 | </head> |
69 | 58 |
|
70 | | - |
71 | 59 | <body> |
72 | 60 |
|
73 | | - |
74 | | - <div id=hdr> |
75 | | - |
76 | | - <div> |
77 | | - <a href='https://ext-code.com/'> |
78 | | - home |
79 | | - </a> |
80 | | - |
81 | | - <a href='../../../code.html'> |
82 | | - libs |
83 | | - </a> |
84 | | - </div> |
85 | | - |
86 | | - <h1> |
87 | | - libs / js / io / file-server / file-server.js |
88 | | - </h1> |
89 | | - |
90 | | - <div> |
91 | | - 19 Dec 2025 |
92 | | - </div> |
93 | | - |
94 | | - </div hdr> |
95 | | - |
96 | | - |
97 | | - <div> |
98 | | - |
99 | | - |
100 | | - <p> |
101 | | - This library interfaces the server to expose direct file system operations to the browser through a simple fetch‑based API. By sending requests such as |
102 | | - </p> |
103 | | - |
104 | | - <p> |
105 | | - the library requires nodejs to be installed |
106 | | - </p> |
107 | | - |
108 | | - <div> |
109 | | - <input value=download type=button> |
110 | | - </div> |
111 | | - |
112 | | - <code> |
113 | | - |
114 | | - var fs = await import(); |
115 | | - |
116 | | - fs.url = 'localhost'; |
117 | | - fs.port = 3000; |
118 | | - fs.auth = 'my-auth'; |
119 | | - |
120 | | - var {blob,error} = await fs.file.load('a.txt'); |
121 | | - if(error){ |
122 | | - console.error(error); |
123 | | - return; |
124 | | - } |
125 | | - var txt = await blob.text(); |
126 | | - console.log(txt); |
127 | | - |
128 | | - </code> |
129 | | - |
130 | | - <p> |
131 | | - the browser can interact with local files securely and consistently. |
132 | | - </p> |
133 | | - |
134 | | - <p> |
135 | | - Supported operations include: |
136 | | - </p> |
137 | | - |
138 | | - <p> |
139 | | - load → retrieve file contents |
140 | | - </p> |
141 | | - |
142 | | - <p> |
143 | | - save → write or overwrite file data |
144 | | - </p> |
145 | | - |
146 | | - <p> |
147 | | - file delete → remove a file |
148 | | - </p> |
149 | | - |
150 | | - <p> |
151 | | - dir read → list directory contents |
152 | | - </p> |
153 | | - |
154 | | - <p> |
155 | | - dir create → make a new directory |
156 | | - </p> |
157 | | - |
158 | | - <p> |
159 | | - dir delete → remove a directory |
160 | | - </p> |
161 | | - |
162 | | - <p> |
163 | | - Together, these commands provide a complete set of standard file I/O capabilities accessible from the browser. This member sits at the Code stage of the pipeline: more substantial than a library, since it defines a working server with a defined protocol, but not yet a full project. It serves as a foundation for building browser‑driven file management tools, developer utilities, or experimental web‑native applications. |
164 | | - </p> |
165 | | - |
166 | | - </div> |
167 | | - |
168 | | - <web-editor component fullsize src='https://libs.ext-code.com/js/io/file-server/file-server.js'></web-editor> |
| 61 | + <page-html v1.0 component=grp2 style='display:block'></page-html> |
169 | 62 |
|
170 | 63 | </body> |
171 | 64 |
|
172 | | - <script> |
173 | | - |
174 | | - |
175 | | - var jszip; |
176 | | - |
177 | | - |
178 | | - var btn = {}; |
179 | | - |
180 | | - |
181 | | - //: |
182 | | - |
183 | | - |
184 | | - function initdom(){ |
185 | | - |
186 | | - $('[value=download]').onclick = btn.download; |
187 | | - |
188 | | - }//initdom |
189 | | - |
190 | | - |
191 | | - //: |
192 | | - |
193 | | - |
194 | | - btn.download = async function(){ |
195 | | - |
196 | | - |
197 | | - var res = await fetch('https://raw.githubusercontent.com/javascript-2020/libs/main/io/file-server/file-server.js'); |
198 | | - var blob = await res.blob(); |
199 | | - |
200 | | - var url = window.URL.createObjectURL(blob); |
201 | | - var a = document.createElement('a'); |
202 | | - a.download = 'file-server'; |
203 | | - a.href = url; |
204 | | - a.click(); |
205 | | - |
206 | | - }//download |
207 | | - |
208 | | - |
209 | | - </script> |
210 | | - |
211 | 65 | </html> |
212 | 66 |
|
213 | 67 |
|
214 | | - |
215 | | - |
216 | | - |
0 commit comments