1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-03 12:50:04 +02:00

add node modules to repo

This commit is contained in:
s2
2018-06-03 13:47:11 +02:00
parent e8c95255e8
commit d002126b72
4115 changed files with 440218 additions and 7519 deletions

2
node_modules/progress-stream/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules
.DS_Store

23
node_modules/progress-stream/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,23 @@
Copyright (c) Tobias Baunbæk <freeall@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

163
node_modules/progress-stream/README.md generated vendored Normal file
View File

@@ -0,0 +1,163 @@
# progress-stream
Read the progress of a stream. Supports speed and eta.
Gets the lengths of the stream automatically if you're using the request or http module. You can also pass the length on initiation. Progress-stream will also check to see if the stream already have a length property.
npm install progress-stream
## Usage
This example copies a large file, and prints out the percentage, speed and remaining every 100ms.
```js
var progress = require('progress-stream');
var fs = require('fs');
var stat = fs.statSync(filename);
var str = progress({
length: stat.size,
time: 100
});
str.on('progress', function(progress) {
console.log(progress);
/*
{
percentage: 9.05,
transferred: 949624,
length: 10485760,
remaining: 9536136,
eta: 42,
runtime: 3,
delta: 295396,
speed: 949624
}
*/
});
fs.createReadStream(filename)
.pipe(str)
.pipe(fs.createWriteStream(output));
```
## Methods
### progress([options], [onprogress])
You can instantiate in two ways:
``` js
var str = progress({time:100});
str.on('progress', function(progress) { ... });
```
or inline the progress listener
``` js
var str = progress({time:100}, function(progress) { ... });
```
## Properties
### .progress
You can get the progress from the progress property.
``` js
var str = progress({time:100});
console.log(str.progress);
/*
{
percentage: 9.05,
transferred: 949624,
length: 10485760,
remaining: 9536136,
eta: 10,
runtime: 0,
delta: 295396,
speed: 949624
}
*/
```
## Events
### on('progress', function(progress) { ... })
``` js
var str = progress({time:100});
str.on('progress', function(progress) { ... });
```
## Options
### time(integer)
Sets how often progress events is emitted. If omitted then defaults to emit every time a chunk is received.
### speed(integer)
Sets how long the speedometer needs to calculate the speed. Defaults to 5 sec.
### length(integer)
If you already know the length of the stream, then you can set it. Defaults to 0.
### drain(boolean)
In case you don't want to include a readstream after progress-stream, set to true to drain automatically. Defaults to false.
### transferred(integer)
If you want to set how much data have previous been downloaded. Useful for a resumed download.
## Examples
### Using the request module
This example uses request to download a 100 MB file, and writes out the percentage every second.
You can also find an example in `test/request.js`.
``` js
var progress = require('progress-stream');
var req = require('request');
var fs = require('fs');
var str = progress({
time: 1000
});
str.on('progress', function(progress) {
console.log(Math.round(progress.percentage)+'%');
});
req('http://cachefly.cachefly.net/100mb.test', { headers: { 'user-agent': 'test' }})
.pipe(str)
.pipe(fs.createWriteStream('test.data'));
```
### Using the http module
In `test/http.js` it's shown how to do it with the http module.
## Methods
### `setLength(newLength)`
Sometimes, you don't know how big a stream is right away (e.g. multipart file uploads). You might find out after a few chunks have already passed through the stream, seconds or even minutes later. In this case, you can use the `setLength` method to recalculate the relevant tracked progress data.
```js
var str = progress({});
someFickleStreamInstance.pipe(str).pipe(fs.createWriteStream('test.data'));
someFickleStreamInstance.on('conviction', function nowIKnowMyLength (actualLength) {
str.setLength(actualLength);
});
```

98
node_modules/progress-stream/index.js generated vendored Normal file
View File

@@ -0,0 +1,98 @@
var through = require('through2');
var speedometer = require('speedometer');
module.exports = function(options, onprogress) {
if (typeof options === 'function') return module.exports(null, options);
options = options || {};
var length = options.length || 0;
var time = options.time || 0;
var drain = options.drain || false;
var transferred = options.transferred || 0;
var nextUpdate = Date.now()+time;
var delta = 0;
var speed = speedometer(options.speed || 5000);
var startTime = Date.now();
var update = {
percentage: 0,
transferred: transferred,
length: length,
remaining: length,
eta: 0,
runtime: 0
};
var emit = function(ended) {
update.delta = delta;
update.percentage = ended ? 100 : (length ? transferred/length*100 : 0);
update.speed = speed(delta);
update.eta = Math.round(update.remaining / update.speed);
update.runtime = parseInt((Date.now() - startTime)/1000);
nextUpdate = Date.now()+time;
delta = 0;
tr.emit('progress', update);
};
var write = function(chunk, enc, callback) {
var len = options.objectMode ? 1 : chunk.length;
transferred += len;
delta += len;
update.transferred = transferred;
update.remaining = length >= transferred ? length - transferred : 0;
if (Date.now() >= nextUpdate) emit(false);
callback(null, chunk);
};
var end = function(callback) {
emit(true);
callback();
};
var tr = through(options.objectMode ? {objectMode:true, highWaterMark:16} : {}, write, end);
var onlength = function(newLength) {
length = newLength;
update.length = length;
update.remaining = length - update.transferred;
tr.emit('length', length);
};
// Expose `onlength()` handler as `setLength()` to support custom use cases where length
// is not known until after a few chunks have already been pumped, or is
// calculated on the fly.
tr.setLength = onlength;
tr.on('pipe', function(stream) {
if (typeof length === 'number') return;
// Support http module
if (stream.readable && !stream.writable && stream.headers) {
return onlength(parseInt(stream.headers['content-length'] || 0));
}
// Support streams with a length property
if (typeof stream.length === 'number') {
return onlength(stream.length);
}
// Support request module
stream.on('response', function(res) {
if (!res || !res.headers) return;
if (res.headers['content-encoding'] === 'gzip') return;
if (res.headers['content-length']) {
return onlength(parseInt(res.headers['content-length']));
}
});
});
if (drain) tr.resume();
if (onprogress) tr.on('progress', onprogress);
tr.progress = function() {
update.speed = speed(0);
update.eta = Math.round(update.remaining / update.speed);
return update;
};
return tr;
};

72
node_modules/progress-stream/package.json generated vendored Normal file
View File

@@ -0,0 +1,72 @@
{
"_args": [
[
"progress-stream@1.2.0",
"/home/s2/Documents/Code/gitlit"
]
],
"_development": true,
"_from": "progress-stream@1.2.0",
"_id": "progress-stream@1.2.0",
"_inBundle": false,
"_integrity": "sha1-LNPP6jO6OonJwSHsM0er6asSX3c=",
"_location": "/progress-stream",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "progress-stream@1.2.0",
"name": "progress-stream",
"escapedName": "progress-stream",
"rawSpec": "1.2.0",
"saveSpec": null,
"fetchSpec": "1.2.0"
},
"_requiredBy": [
"/nugget"
],
"_resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-1.2.0.tgz",
"_spec": "1.2.0",
"_where": "/home/s2/Documents/Code/gitlit",
"author": {
"name": "freeall",
"email": "freeall@gmail.com"
},
"bugs": {
"url": "https://github.com/freeall/progress-stream/issues"
},
"dependencies": {
"speedometer": "~0.1.2",
"through2": "~0.2.3"
},
"description": "Read the progress of a stream",
"devDependencies": {
"numeral": "~1.5.2",
"request": "~2.29.0",
"single-line-log": "~1.0.0"
},
"homepage": "https://github.com/freeall/progress-stream#readme",
"keywords": [
"stream",
"progress",
"percentage",
"percent",
"download",
"upload",
"file",
"streaming",
"request",
"http"
],
"license": "BSD-2-Clause",
"main": "index.js",
"name": "progress-stream",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/freeall/progress-stream.git"
},
"scripts": {
"test": "node test/http.js && node test/request.js"
},
"version": "1.2.0"
}

30
node_modules/progress-stream/test/http.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
var progress = require('../index');
var http = require('http');
var fs = require('fs');
var log = require('single-line-log').stdout;
var numeral = require('numeral');
var str = progress({
drain: true,
time: 100,
speed: 20
});
str.on('progress', function(progress) {
log('Running: '+numeral(progress.runtime).format('00:00:00')+' ('+numeral(progress.transferred).format('0 b')+')\n'+
'Left: '+numeral(progress.eta).format('00:00:00')+' ('+numeral(progress.remaining).format('0 b')+')\n'+
numeral(progress.speed).format('0.00b')+'/s '+Math.round(progress.percentage)+'%');
});
var options = {
method: 'GET',
host: 'cachefly.cachefly.net',
path: '/10mb.test',
headers: {
'user-agent': 'testy test'
}
};
http.request(options, function(response) {
response.pipe(str);
}).end();
console.log('progress-stream using http module - downloading 10 MB file');

20
node_modules/progress-stream/test/request.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
var progress = require('../index');
var req = require('request');
var fs = require('fs');
var log = require('single-line-log').stdout;
var numeral = require('numeral');
var str = progress({
drain: true,
time: 100
}, function(progress) {
log('Running: '+numeral(progress.runtime).format('00:00:00')+' ('+numeral(progress.transferred).format('0 b')+')\n'+
'Left: '+numeral(progress.eta).format('00:00:00')+' ('+numeral(progress.remaining).format('0 b')+')\n'+
numeral(progress.speed).format('0.00b')+'/s '+Math.round(progress.percentage)+'%');
});
req('http://cachefly.cachefly.net/10mb.test', {
headers: { 'user-agent': 'test' }
}).pipe(str);
console.log('progress-stream using request module - downloading 10 MB file');