@wooksjs/http-static 0.2.18 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -9
- package/dist/index.cjs +1215 -1185
- package/dist/index.mjs +1215 -1185
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
</a>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
Wooks Serve File is composable static file server for [@wooksjs/event-http](https://github.com/wooksjs/wooksjs/tree/main/packages/event-http).
|
|
14
13
|
|
|
15
14
|
`serveFile` returns a readable stream and prepares all the neccessary response headers (like content-length, content-type etc).
|
|
16
15
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
16
|
+
- ✅ returns a readable stream
|
|
17
|
+
- ✅ prepares all the neccessary response headers (like content-length, content-type etc)
|
|
18
|
+
- ✅ can handle etag
|
|
19
|
+
- ✅ can handle ranges
|
|
21
20
|
|
|
22
21
|
## Install
|
|
23
22
|
|
|
@@ -25,7 +24,6 @@ Wooks Serve File is composable static file server for [@wooksjs/event-http](http
|
|
|
25
24
|
|
|
26
25
|
## Usage
|
|
27
26
|
|
|
28
|
-
|
|
29
27
|
```js
|
|
30
28
|
import { serveFile } from '@wooksjs/http-static'
|
|
31
29
|
// ...
|
|
@@ -33,6 +31,7 @@ serveFile(filePath, options)
|
|
|
33
31
|
```
|
|
34
32
|
|
|
35
33
|
**serveFile options**
|
|
34
|
+
|
|
36
35
|
```ts
|
|
37
36
|
{
|
|
38
37
|
// Any header to add
|
|
@@ -55,10 +54,10 @@ serveFile(filePath, options)
|
|
|
55
54
|
|
|
56
55
|
// when true lists files in directory
|
|
57
56
|
listDirectory?: boolean,
|
|
58
|
-
|
|
57
|
+
|
|
59
58
|
// put 'index.html'
|
|
60
|
-
// to automatically serve it from the folder
|
|
61
|
-
index?: string,
|
|
59
|
+
// to automatically serve it from the folder
|
|
60
|
+
index?: string,
|
|
62
61
|
}
|
|
63
62
|
```
|
|
64
63
|
|