Skip to content

kt3k/iterable_file_server

Repository files navigation

iterable_file_server v0.2.0

Serve items from AsyncIterable<File>

Usage

import { serve } from "https://deno.land/x/iterable_file_server@v0.2.0/mod.ts";

async function* generateItems() {
  yield new File(["foo"], "foo.html");
  yield new File(["bar"], "foo/bar.html");
  yield new File(["baz"], "foo/bar/baz.html");
  // ...
}

const server = serve(generateItems(), { port: 3000 });
// This serves the follwoing paths:
// - http://localhost:3000/foo.html
// - http://localhost:3000/foo/bar.html
// - http://localhost:3000/foo/bar/baz.html
// This also serves the debug page:
// - http://localhost:3000/__debug__

// ...

// When you want to stop the server.
server.close();

This depends on native http bindings, so you need --unstable flag to use this module.

History

  • 2021-10-20 v0.2.0 Use File interface for a file #5.
  • 2021-07-31 v0.1.7 Set content-type header #3.

License

MIT

About

Serve items from `AsyncIterable<File>`

Topics

Resources

License

Stars

Watchers

Forks

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy