GitXplorerGitXplorer
t

range_header

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
4e2b2b27b3d2170f98b642310a45a5ef0c1c97cf

+2

tthosakwe committed 6 years ago
Unverified
dd09ee9294cf00e9b405450e7c54da841c6c8bd2

+1

tthosakwe committed 6 years ago
Unverified
7265a37270d8d14019058d8a1bbfbde71bee3413

2.0.2

tthosakwe committed 6 years ago
Unverified
a3aa953aaf2e3d02c153a0305ad373f87498a8c3

2.0.2

tthosakwe committed 6 years ago
Unverified
59a844daf96387b69b210683d51de3c9305c19b3

2.0.1

tthosakwe committed 6 years ago
Unverified
d9305cbcd683a291a336bd0230f1ac48c747e85b

Add deps

tthosakwe committed 6 years ago

README

The README file for this repository.

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