range_header 2.0.2+2

Dart native
Flutter Android iOS

Range header parser for Dart. Beyond parsing, a stream transformer is included.

range_header #

Pub build status

Range header parser for Dart.

Installation #

In your pubspec.yaml:

dependencies:
  range_header: ^2.0.0

Usage #

handleRequest(HttpRequest request) async {
  // Parse the header
  var header = new RangeHeader.parse(request.headers.value(HttpHeaders.rangeHeader));

  // Optimize/canonicalize it
  var items = RangeHeader.foldItems(header.items);
  header = new RangeHeader(items);

  // Get info
  header.items;
  header.rangeUnit;
  print(header.items[0].toContentRange(fileSize));

  // Serve the file
  var transformer = new RangeHeaderTransformer(header);
  await file.openRead().transform(transformer).pipe(request.response);
}
0
likes
90
pub points
77%
popularity

Range header parser for Dart. Beyond parsing, a stream transformer is included.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

thosakwe@gmail.com

License

MIT (LICENSE)

Dependencies

async, charcode, quiver_hashcode, source_span, string_scanner

More

Packages that depend on range_header