# add dist

This commit is contained in:
Mario Romano
2016-04-21 11:56:31 +01:00
parent 5914688467
commit 07807e7bc3
13499 changed files with 1808930 additions and 5 deletions

View File

@@ -0,0 +1,40 @@
unreleased
==========
* perf: enable strict mode
1.0.2 / 2014-09-08
==================
* Support Node.js 0.6
1.0.1 / 2014-09-07
==================
* Move repository to jshttp
1.0.0 / 2013-12-11
==================
* Add repository to package.json
* Add MIT license
0.0.4 / 2012-06-17
==================
* Change ret -1 for unsatisfiable and -2 when invalid
0.0.3 / 2012-06-17
==================
* Fix last-byte-pos default to len - 1
0.0.2 / 2012-06-14
==================
* Add `.type`
0.0.1 / 2012-06-11
==================
* Initial release

View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2012-2014 TJ Holowaychuk <vision-media.ca>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,57 @@
# range-parser
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Range header field parser.
## Installation
```
$ npm install range-parser
```
## API
```js
var parseRange = require('range-parser')
```
### parseRange(size, header)
Parse the given `header` string where `size` is the maximum size of the resource.
An array of ranges will be returned or negative numbers indicating an error parsing.
* `-2` signals a malformed header string
* `-1` signals an invalid range
```js
// parse header from request
var range = parseRange(req.headers.range)
// the type of the range
if (range.type === 'bytes') {
// the ranges
range.forEach(function (r) {
// do something with r.start and r.end
})
}
```
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/range-parser.svg
[npm-url]: https://npmjs.org/package/range-parser
[node-version-image]: https://img.shields.io/node/v/range-parser.svg
[node-version-url]: http://nodejs.org/download/
[travis-image]: https://img.shields.io/travis/jshttp/range-parser.svg
[travis-url]: https://travis-ci.org/jshttp/range-parser
[coveralls-image]: https://img.shields.io/coveralls/jshttp/range-parser.svg
[coveralls-url]: https://coveralls.io/r/jshttp/range-parser
[downloads-image]: https://img.shields.io/npm/dm/range-parser.svg
[downloads-url]: https://npmjs.org/package/range-parser

View File

@@ -0,0 +1,63 @@
/*!
* range-parser
* Copyright(c) 2012-2014 TJ Holowaychuk
* MIT Licensed
*/
'use strict';
/**
* Module exports.
* @public
*/
module.exports = rangeParser;
/**
* Parse "Range" header `str` relative to the given file `size`.
*
* @param {Number} size
* @param {String} str
* @return {Array}
* @public
*/
function rangeParser(size, str) {
var valid = true;
var i = str.indexOf('=');
if (-1 == i) return -2;
var arr = str.slice(i + 1).split(',').map(function(range){
var range = range.split('-')
, start = parseInt(range[0], 10)
, end = parseInt(range[1], 10);
// -nnn
if (isNaN(start)) {
start = size - end;
end = size - 1;
// nnn-
} else if (isNaN(end)) {
end = size - 1;
}
// limit last-byte-pos to current length
if (end > size - 1) end = size - 1;
// invalid
if (isNaN(start)
|| isNaN(end)
|| start > end
|| start < 0) valid = false;
return {
start: start,
end: end
};
});
arr.type = str.slice(0, i);
return valid ? arr : -1;
}

View File

@@ -0,0 +1,102 @@
{
"_args": [
[
"range-parser@~1.0.3",
"/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/serve-static/node_modules/send"
]
],
"_from": "range-parser@>=1.0.3 <1.1.0",
"_id": "range-parser@1.0.3",
"_inCache": true,
"_installable": true,
"_location": "/range-parser",
"_npmUser": {
"email": "doug@somethingdoug.com",
"name": "dougwilson"
},
"_npmVersion": "1.4.28",
"_phantomChildren": {},
"_requested": {
"name": "range-parser",
"raw": "range-parser@~1.0.3",
"rawSpec": "~1.0.3",
"scope": null,
"spec": ">=1.0.3 <1.1.0",
"type": "range"
},
"_requiredBy": [
"/live-server/send",
"/serve-static/send"
],
"_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.0.3.tgz",
"_shasum": "6872823535c692e2c2a0103826afd82c2e0ff175",
"_shrinkwrap": null,
"_spec": "range-parser@~1.0.3",
"_where": "/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/serve-static/node_modules/send",
"author": {
"email": "tj@vision-media.ca",
"name": "TJ Holowaychuk",
"url": "http://tjholowaychuk.com"
},
"bugs": {
"url": "https://github.com/jshttp/range-parser/issues"
},
"dependencies": {},
"description": "Range header field string parser",
"devDependencies": {
"istanbul": "0.4.0",
"mocha": "1.21.5"
},
"directories": {},
"dist": {
"shasum": "6872823535c692e2c2a0103826afd82c2e0ff175",
"tarball": "https://registry.npmjs.org/range-parser/-/range-parser-1.0.3.tgz"
},
"engines": {
"node": ">= 0.6"
},
"files": [
"HISTORY.md",
"LICENSE",
"index.js"
],
"gitHead": "18e46a3de74afff9f4e22717f11ddd6e9aa6d845",
"homepage": "https://github.com/jshttp/range-parser",
"keywords": [
"range",
"parser",
"http"
],
"license": "MIT",
"maintainers": [
{
"email": "tj@vision-media.ca",
"name": "tjholowaychuk"
},
{
"email": "jonathanrichardong@gmail.com",
"name": "jonathanong"
},
{
"email": "doug@somethingdoug.com",
"name": "dougwilson"
},
{
"email": "jonathanrichardong@gmail.com",
"name": "jongleberry"
}
],
"name": "range-parser",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/jshttp/range-parser.git"
},
"scripts": {
"test": "mocha --reporter spec",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
},
"version": "1.0.3"
}