Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hyp3rflow/zipland
Serve file server with single zip file as file system in Deno.
https://github.com/hyp3rflow/zipland
deno file-server zip
Last synced: 6 days ago
JSON representation
Serve file server with single zip file as file system in Deno.
- Host: GitHub
- URL: https://github.com/hyp3rflow/zipland
- Owner: hyp3rflow
- License: mit
- Created: 2022-07-04T14:09:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-07T03:34:06.000Z (over 2 years ago)
- Last Synced: 2024-12-17T16:13:48.137Z (16 days ago)
- Topics: deno, file-server, zip
- Language: TypeScript
- Homepage:
- Size: 23.4 KB
- Stars: 19
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zipland
Serve file server with one-single zip file in Deno.
## Support
### zip
- just zip32 with deflated or uncompressed
### serving
- plaintext
- deflate## Examples
You can serve your zip file with just single line.
```typescript
import { serveZip } from "https://deno.land/x/zipland/mod.ts";serveZip("./my.zip");
```Or you can serve the zip file in your own serve implementation.
```typescript
import { serve } from "https://deno.land/std/http/mod.ts";
import {
disassembleZip,
serveZipFiles,
} from "https://deno.land/x/zipland/mod.ts";const file = await Deno.open(path);
const zip = await disassembleZip(zip);
if (zip) {
const handler = (req: Request): Promise => {
const pathname = new URL(req.url).pathname;
switch (pathname) {
case "/file": {
return serveZipFiles(req, zip, { urlRoot: "/file" });
}
}
// serve other things too!
};
serve(handler);
}
```You can see and run above example in `/test` directory