Clone this repo:
  1. 7337909 Added option to allow for mimetype lookup via magic numbers by Kevin Moore · 3 weeks ago master
  2. 366d49a Some cleanup by Matthew Barbour · 3 weeks ago
  3. 82e6a33 Documented useHeaderBytesForContentType by Matthew Barbour · 6 weeks ago
  4. b22d2f3 Changed header byte check to use up to 25 bytes for the check, chaned arg to be named header bytes instead of magic bytes by Matthew Barbour · 6 weeks ago
  5. a1135bb Added test by Matthew Barbour · 6 weeks ago

shelf_static is a Handler for the Dart shelf package.

Build Status Coverage Status

Example

import 'package:shelf/shelf_io.dart' as io;
import 'package:shelf_static/shelf_static.dart';

void main() {
  var handler = createStaticHandler('example/files', 
      defaultDocument: 'index.html');

  io.serve(handler, 'localhost', 8080);
}