shelf_static 0.2.8

  • Readme
  • Changelog
  • Installing
  • 87

shelf_static is a Handler for the Dart shelf package.

Build 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);
}

0.2.8 #

  • Update SDK constraint to >=2.0.0-dev.61 <3.0.0.

  • Directory listings are now sorted.

0.2.7+1 #

  • Updated SDK version to 2.0.0-dev.17.0

0.2.7 #

  • Require at least Dart SDK 1.24.0.
  • Other internal changes e.g. removing dep on scheduled_test.

0.2.6 #

  • Add a createFileHandler() function that serves a single static file.

0.2.5 #

  • Add an optional contentTypeResolver argument to createStaticHandler.

0.2.4 #

  • Add support for "sniffing" the content of the file for the content-type via an optional useHeaderBytesForContentType argument on createStaticHandler.

0.2.3+4 #

  • Support http_parser 3.0.0.

0.2.3+3 #

  • Support shelf 0.7.0.

0.2.3+2 #

  • Support http_parser 2.0.0.

0.2.3+1 #

  • Support http_parser 1.0.0.

0.2.3 #

  • Added listDirectories argument to createStaticHandler.

0.2.2 #

  • Bumped up minimum SDK to 1.7.0.

  • Added support for shelf 0.6.0.

0.2.1 #

  • Removed Uri format checks now that the core libraries is more strict.

0.2.0 #

  • Removed deprecated getHandler.

  • Send correct mime type for default document.

0.1.4+6 #

  • Updated development dependencies.

0.1.4+5 #

  • Handle differences in resolution between DateTime and HTTP date format.

0.1.4+4 #

  • Using latest shelf. Cleaned up test code by using new features.

0.1.4 #

  • Added named (optional) defaultDocument argument to createStaticHandler.

0.1.3 #

  • createStaticHandler added serveFilesOutsidePath optional parameter.

0.1.2 #

  • The preferred top-level method is now createStaticHandler. getHandler is deprecated.
  • Set content-type header if the mime type of the requested file can be determined from the file extension.
  • Respond with 304-Not modified against IF-MODIFIED-SINCE request header.
  • Better error when provided a non-existent fileSystemPath.
  • Added example/example_server.dart.

0.1.1+1 #

  • Removed work around for issue.

0.1.1 #

  • Correctly handle requests when not hosted at the root of a site.
  • Send last-modified header.
  • Work around known issue with HTTP date formatting.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  shelf_static: ^0.2.8

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:shelf_static/shelf_static.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
96
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
47
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

We analyzed this package on Nov 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:shelf_static/shelf_static.dart with components: io.

Health suggestions

Fix lib/src/static_handler.dart. (-1.49 points)

Analysis of lib/src/static_handler.dart reported 3 hints:

line 43 col 32: Use = to separate a named parameter from its default value.

line 45 col 25: Use = to separate a named parameter from its default value.

line 46 col 38: Use = to separate a named parameter from its default value.

Maintenance suggestions

Package is getting outdated. (-32.60 points)

The package was last published 69 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and shelf_static.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.61.0 <3.0.0
convert >=1.0.0 <3.0.0 2.1.1
http_parser >=0.0.2+2 <4.0.0 3.1.3
mime >=0.9.0 <0.10.0 0.9.6+3
path >=1.1.0 <2.0.0 1.6.4
shelf >=0.5.7 <0.8.0 0.7.5
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
meta 1.1.8
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
args ^1.0.0
test ^1.2.0
test_descriptor ^1.0.0