aggiunti componenti bower/node
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"predef": [
|
||||
"console",
|
||||
"require",
|
||||
"define",
|
||||
"describe",
|
||||
"it",
|
||||
"before",
|
||||
"beforeEach",
|
||||
"after",
|
||||
"afterEach"
|
||||
],
|
||||
|
||||
"node": true,
|
||||
"devel": true,
|
||||
|
||||
"bitwise": true,
|
||||
"curly": true,
|
||||
"eqeqeq": false,
|
||||
"forin": false,
|
||||
"immed": true,
|
||||
"latedef": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": true,
|
||||
"plusplus": false,
|
||||
"regexp": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"quotmark": "single",
|
||||
"strict": true,
|
||||
"trailing": true,
|
||||
|
||||
"asi": false,
|
||||
"boss": false,
|
||||
"debug": false,
|
||||
"eqnull": true,
|
||||
"es5": false,
|
||||
"esnext": false,
|
||||
"evil": false,
|
||||
"expr": false,
|
||||
"funcscope": false,
|
||||
"globalstrict": false,
|
||||
"iterator": false,
|
||||
"lastsemic": false,
|
||||
"laxbreak": false,
|
||||
"laxcomma": false,
|
||||
"loopfunc": true,
|
||||
"multistr": false,
|
||||
"onecase": true,
|
||||
"regexdash": false,
|
||||
"scripturl": false,
|
||||
"smarttabs": false,
|
||||
"shadow": false,
|
||||
"sub": false,
|
||||
"supernew": false,
|
||||
"validthis": false,
|
||||
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"white": true
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
/node_modules
|
||||
/npm-debug.*
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2012 IndigoUnited
|
||||
|
||||
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.
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
# request-progress [](http://travis-ci.org/IndigoUnited/node-request-progress.png)
|
||||
|
||||
Tracks the download progress of a request made with [request](https://github.com/mikeal/request).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
`$ npm install request-progress`
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var fs = require('fs');
|
||||
var request = require('request');
|
||||
var progress = require('request-progress');
|
||||
|
||||
// Note that the options argument is optional
|
||||
progress(request('http://google.com/doodle.png'), {
|
||||
throttle: 2000, // Throttle the progress event to 2000ms, defaults to 1000ms
|
||||
delay: 1000 // Only start to emit after 1000ms delay, defaults to 0ms
|
||||
})
|
||||
.on('progress', function (state) {
|
||||
console.log('received size in bytes', state.received);
|
||||
// The properties bellow can be null if response does not contain
|
||||
// the content-length header
|
||||
console.log('total size in bytes', state.total);
|
||||
console.log('percent', state.percent);
|
||||
})
|
||||
.on('error', function (err) {
|
||||
// Do something with err
|
||||
})
|
||||
.pipe(fs.createWriteStream('doodle.png'))
|
||||
.on('error', function (err) {
|
||||
// Do something with err
|
||||
})
|
||||
.on('close', function (err) {
|
||||
// Saved to doogle.png!
|
||||
})
|
||||
```
|
||||
|
||||
Note that the `state` object emitted in the `progress` event is reused to avoid creating a new object for each event.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
|
||||
var throttle = require('throttleit');
|
||||
|
||||
function requestProgress(request, options) {
|
||||
var reporter;
|
||||
var onResponse;
|
||||
var delayTimer;
|
||||
var delayCompleted;
|
||||
var totalSize;
|
||||
var previousReceivedSize;
|
||||
var receivedSize = 0;
|
||||
var state = {};
|
||||
|
||||
options = options || {};
|
||||
options.throttle = options.throttle == null ? 1000 : options.throttle;
|
||||
options.delay = options.delay || 0;
|
||||
|
||||
// Throttle the progress report function
|
||||
reporter = throttle(function () {
|
||||
// If the received size is the same, do not report
|
||||
if (previousReceivedSize === receivedSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update received
|
||||
previousReceivedSize = receivedSize;
|
||||
state.received = receivedSize;
|
||||
|
||||
// Update percentage
|
||||
// Note that the totalSize might available
|
||||
state.percent = totalSize ? Math.round(receivedSize / totalSize * 100) : null;
|
||||
|
||||
request.emit('progress', state);
|
||||
}, options.throttle);
|
||||
|
||||
// On response handler
|
||||
onResponse = function (response) {
|
||||
totalSize = Number(response.headers['content-length']);
|
||||
receivedSize = 0;
|
||||
|
||||
// Note that the totalSize might available
|
||||
state.total = totalSize || null;
|
||||
|
||||
// Delay the progress report
|
||||
delayCompleted = false;
|
||||
delayTimer = setTimeout(function () {
|
||||
delayCompleted = true;
|
||||
delayTimer = null;
|
||||
}, options.delay);
|
||||
};
|
||||
|
||||
request
|
||||
.on('request', function () {
|
||||
receivedSize = 0;
|
||||
})
|
||||
.on('response', onResponse)
|
||||
.on('data', function (data) {
|
||||
receivedSize += data.length;
|
||||
|
||||
if (delayCompleted) {
|
||||
reporter();
|
||||
}
|
||||
})
|
||||
.on('end', function () {
|
||||
if (delayTimer) {
|
||||
clearTimeout(delayTimer);
|
||||
delayTimer = null;
|
||||
}
|
||||
});
|
||||
|
||||
// If we already got a response, call the on response handler
|
||||
if (request.response) {
|
||||
onResponse(request.response);
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
module.exports = requestProgress;
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"request-progress@0.3.1",
|
||||
"C:\\Users\\samuele.STEAMWAREWIN\\Documents\\VisualStudioProjects\\StockMan\\StockManMVC\\node_modules\\cldr-data-downloader"
|
||||
]
|
||||
],
|
||||
"_from": "request-progress@0.3.1",
|
||||
"_id": "request-progress@0.3.1",
|
||||
"_inCache": true,
|
||||
"_location": "/request-progress",
|
||||
"_npmUser": {
|
||||
"email": "andremiguelcruz@msn.com",
|
||||
"name": "satazor"
|
||||
},
|
||||
"_npmVersion": "1.3.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "request-progress",
|
||||
"raw": "request-progress@0.3.1",
|
||||
"rawSpec": "0.3.1",
|
||||
"scope": null,
|
||||
"spec": "0.3.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cldr-data-downloader"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/request-progress/-/request-progress-0.3.1.tgz",
|
||||
"_shasum": "0721c105d8a96ac6b2ce8b2c89ae2d5ecfcf6b3a",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "request-progress@0.3.1",
|
||||
"_where": "C:\\Users\\samuele.STEAMWAREWIN\\Documents\\VisualStudioProjects\\StockMan\\StockManMVC\\node_modules\\cldr-data-downloader",
|
||||
"author": {
|
||||
"email": "hello@indigounited.com",
|
||||
"name": "IndigoUnited",
|
||||
"url": "http://indigounited.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/IndigoUnited/node-request-progress/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"throttleit": "~0.0.2"
|
||||
},
|
||||
"description": "Tracks the download progress of a request made with mikeal/request",
|
||||
"devDependencies": {
|
||||
"expect.js": "~0.2.0",
|
||||
"mocha": "~1.12.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0721c105d8a96ac6b2ce8b2c89ae2d5ecfcf6b3a",
|
||||
"tarball": "https://registry.npmjs.org/request-progress/-/request-progress-0.3.1.tgz"
|
||||
},
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"bytes",
|
||||
"mikeal",
|
||||
"percent",
|
||||
"percentage",
|
||||
"progress",
|
||||
"request",
|
||||
"size"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "satazor",
|
||||
"email": "andremiguelcruz@msn.com"
|
||||
}
|
||||
],
|
||||
"name": "request-progress",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/IndigoUnited/node-request-progress"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha -R spec"
|
||||
},
|
||||
"version": "0.3.1"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
// TODO
|
||||
Reference in New Issue
Block a user