Skip to content

Commit 56f68b6

Browse files
save file
1 parent 237b490 commit 56f68b6

1 file changed

Lines changed: 60 additions & 5 deletions

File tree

code/nodejs/servers/file-server/readme.md

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@
1010

1111
## Description
1212

13+
the file server is a nodejs script that allows interacting with the local file system
14+
such as load, save, delete, create directory etc via a http request from say the browser
15+
16+
the server does have https key and cert built in, however it will load them if there
17+
are files in its directory named cert.pem and key.pem
18+
19+
its use is fairly simple
20+
21+
```
22+
23+
node fs-server
24+
25+
```
26+
1327
This server can run locally and allow access to the local filesystem from the browser / javascript through https requests
1428

1529
```
@@ -20,12 +34,53 @@ This server can run locally and allow access to the local filesystem from the br
2034
2135
```
2236

23-
the client-side library can found at
37+
## requires
38+
39+
- getmime.js
40+
- keys.js
41+
-
42+
43+
44+
45+
46+
47+
the server can be interacted with via the client-side library
2448

2549
[file-server.js](/libs/js/io/file-server/file-server.html)
2650

27-
28-
## requires
2951

30-
- getmime.js
31-
- keys.js
52+
<!--
53+
[file-server.js [ github.com ]](https://github.com/javascript-2020/libs/blob/main/js/io/file-server/file-server.js)
54+
-->
55+
56+
57+
58+
```
59+
60+
61+
<script src='https://cdn.jsdelivr.net/gh/javascript-2020/libs/js/io/file-server/file-server.js'></script>
62+
63+
<script>
64+
65+
(async()=>{
66+
67+
var fs = window['file-server'];
68+
fs.url = 'https://localhost:3000';
69+
fs.auth = 'password';
70+
71+
var {blob,error} = await fs.file.load('/tmp/a.txt');
72+
if(error){
73+
console.error(error);
74+
return;
75+
}
76+
77+
var txt = await blob.text();
78+
console.log(txt);
79+
80+
})();
81+
82+
</script>
83+
84+
```
85+
86+

0 commit comments

Comments
 (0)