This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

View File

@ -0,0 +1,63 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for lib/constants.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<link rel="stylesheet" href="../base.css">
<style type='text/css'>
div.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">lib/constants.js</span></h1>
<h2>
Statements: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">lib/</a> &#187; constants.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7</td><td class="line-coverage"><span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">module.exports = {
DEFAULT_INITIAL_SIZE: (8 * 1024),
DEFAULT_INCREMENT_AMOUNT: (8 * 1024),
DEFAULT_FREQUENCY: 1,
DEFAULT_CHUNK_SIZE: 1024
};
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 01 2015 04:16:19 GMT+0000 (UTC)</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,112 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for lib/</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<link rel="stylesheet" href="../base.css">
<style type='text/css'>
div.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">lib/</span></h1>
<h2>
Statements: <span class="metric">98.01% <small>(148 / 151)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">92.94% <small>(79 / 85)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(20 / 20)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">99.31% <small>(143 / 144)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; lib/</div>
</div>
<div class="body">
<div class="coverage-summary">
<table>
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="constants.js"><a href="constants.js.html">constants.js</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
</tr>
<tr>
<td class="file high" data-value="readable_streambuffer.js"><a href="readable_streambuffer.js.html">readable_streambuffer.js</a></td>
<td data-value="98.82" class="pic high"><span class="cover-fill" style="width: 98px;"></span><span class="cover-empty" style="width:2px;"></span></td>
<td data-value="98.82" class="pct high">98.82%</td>
<td data-value="85" class="abs high">(84&nbsp;/&nbsp;85)</td>
<td data-value="94.34" class="pct high">94.34%</td>
<td data-value="53" class="abs high">(50&nbsp;/&nbsp;53)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="11" class="abs high">(11&nbsp;/&nbsp;11)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="83" class="abs high">(83&nbsp;/&nbsp;83)</td>
</tr>
<tr>
<td class="file high" data-value="streambuffer.js"><a href="streambuffer.js.html">streambuffer.js</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">(3&nbsp;/&nbsp;3)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">(3&nbsp;/&nbsp;3)</td>
</tr>
<tr>
<td class="file high" data-value="writable_streambuffer.js"><a href="writable_streambuffer.js.html">writable_streambuffer.js</a></td>
<td data-value="96.77" class="pic high"><span class="cover-fill" style="width: 96px;"></span><span class="cover-empty" style="width:4px;"></span></td>
<td data-value="96.77" class="pct high">96.77%</td>
<td data-value="62" class="abs high">(60&nbsp;/&nbsp;62)</td>
<td data-value="90.63" class="pct high">90.63%</td>
<td data-value="32" class="abs high">(29&nbsp;/&nbsp;32)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="9" class="abs high">(9&nbsp;/&nbsp;9)</td>
<td data-value="98.25" class="pct high">98.25%</td>
<td data-value="57" class="abs high">(56&nbsp;/&nbsp;57)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 01 2015 04:16:19 GMT+0000 (UTC)</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,453 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for lib/readable_streambuffer.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<link rel="stylesheet" href="../base.css">
<style type='text/css'>
div.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">lib/readable_streambuffer.js</span></h1>
<h2>
Statements: <span class="metric">98.82% <small>(84 / 85)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">94.34% <small>(50 / 53)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(11 / 11)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(83 / 83)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">lib/</a> &#187; readable_streambuffer.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137</td><td class="line-coverage"><span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">268</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">268</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">268</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">var stream = require("stream"),
constants = require("./constants"),
util = require("util");
&nbsp;
var ReadableStreamBuffer = module.exports = function(opts) {
var that = this;
&nbsp;
stream.Stream.call(this);
&nbsp;
opts = opts || {};
var frequency = opts.hasOwnProperty("frequency") ? opts.frequency : constants.DEFAULT_FREQUENCY;
var chunkSize = opts.chunkSize || constants.DEFAULT_CHUNK_SIZE;
var initialSize = opts.initialSize || constants.DEFAULT_INITIAL_SIZE;
var incrementAmount = opts.incrementAmount || constants.DEFAULT_INCREMENT_AMOUNT;
&nbsp;
var size = 0;
var buffer = new Buffer(initialSize);
var encoding = null;
&nbsp;
this.readable = true;
this.writable = false;
&nbsp;
var sendData = function() {
var amount = Math.min(chunkSize, size);
&nbsp;
if (amount &gt; 0) {
var chunk = null;
if(encoding) {
chunk = buffer.toString(encoding, 0, amount);
}
else {
chunk = new Buffer(amount);
buffer.copy(chunk, 0, 0, amount);
}
&nbsp;
that.emit("data", chunk);
&nbsp;
<span class="missing-if-branch" title="else path not taken" >E</span>if(amount &lt; buffer.length)
buffer.copy(buffer, 0, amount, size);
size -= amount;
}
&nbsp;
if(size === 0 &amp;&amp; !that.readable) {
that.emit("end");
that.emit("close");
if (sendData &amp;&amp; sendData.interval) {
clearInterval(sendData.interval);
sendData.interval = null;
}
}
};
&nbsp;
this.size = function() {
return size;
};
&nbsp;
this.maxSize = function() {
return buffer.length;
};
&nbsp;
var increaseBufferIfNecessary = function(incomingDataSize) {
if((buffer.length - size) &lt; incomingDataSize) {
var factor = Math.ceil((incomingDataSize - (buffer.length - size)) / incrementAmount);
&nbsp;
var newBuffer = new Buffer(buffer.length + (incrementAmount * factor));
buffer.copy(newBuffer, 0, 0, size);
buffer = newBuffer;
}
};
&nbsp;
this.put = function(data, encoding) {
<span class="missing-if-branch" title="if path not taken" >I</span>if(!that.readable) <span class="cstat-no" title="statement not covered" >return;</span>
&nbsp;
var wasEmpty = size === 0;
if(Buffer.isBuffer(data)) {
increaseBufferIfNecessary(data.length);
data.copy(buffer, size, 0);
size += data.length;
}
else {
data = data + "";
var dataSizeInBytes = Buffer.byteLength(data);
increaseBufferIfNecessary(dataSizeInBytes);
buffer.write(data, size, encoding || "utf8");
size += dataSizeInBytes;
}
&nbsp;
if (wasEmpty &amp;&amp; size &gt; 0) {
this.emit('readable')
}
&nbsp;
if (!this.isPaused &amp;&amp; !frequency) {
while (size &gt; 0) {
sendData();
}
}
};
&nbsp;
this.pause = function() {
this.isPaused = true;
<span class="missing-if-branch" title="else path not taken" >E</span>if(sendData &amp;&amp; sendData.interval) {
clearInterval(sendData.interval);
delete sendData.interval;
}
};
&nbsp;
this.resume = function() {
this.isPaused = false;
if(sendData &amp;&amp; !sendData.interval &amp;&amp; frequency &gt; 0) {
sendData.interval = setInterval(sendData, frequency);
}
};
&nbsp;
this.destroy = function() {
that.emit("end");
if(sendData.interval) clearInterval(sendData.interval);
sendData = null;
that.readable = false;
that.emit("close");
};
&nbsp;
this.destroySoon = function() {
that.readable = false;
if (!sendData.interval) {
that.emit("end");
that.emit("close");
}
};
&nbsp;
this.setEncoding = function(_encoding) {
encoding = _encoding;
};
&nbsp;
this.resume();
};
util.inherits(ReadableStreamBuffer, stream.Stream);
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 01 2015 04:16:19 GMT+0000 (UTC)</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,54 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for lib/streambuffer.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<link rel="stylesheet" href="../base.css">
<style type='text/css'>
div.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">lib/streambuffer.js</span></h1>
<h2>
Statements: <span class="metric">100% <small>(3 / 3)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(3 / 3)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">lib/</a> &#187; streambuffer.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4</td><td class="line-coverage"><span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">module.exports = require("./constants");
module.exports.ReadableStreamBuffer = require("./readable_streambuffer");
module.exports.WritableStreamBuffer = require("./writable_streambuffer");
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 01 2015 04:16:19 GMT+0000 (UTC)</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,336 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for lib/writable_streambuffer.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<link rel="stylesheet" href="../base.css">
<style type='text/css'>
div.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">lib/writable_streambuffer.js</span></h1>
<h2>
Statements: <span class="metric">96.77% <small>(60 / 62)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">90.63% <small>(29 / 32)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(9 / 9)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">98.25% <small>(56 / 57)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">lib/</a> &#187; writable_streambuffer.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98</td><td class="line-coverage"><span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">var util = require("util"),
stream = require("stream"),
constants = require("./constants");
&nbsp;
// TODO: clear up specs on returning false from a write and emitting a drain event.
// Does this mean if I return false from a write, I should ignore any write requests between that false return and the drain event?
var WritableStreamBuffer = module.exports = function(opts) {
var that = this;
&nbsp;
stream.Stream.call(this);
&nbsp;
opts = opts || {};
var initialSize = opts.initialSize || constants.DEFAULT_INITIAL_SIZE;
var incrementAmount = opts.incrementAmount || constants.DEFAULT_INCREMENT_AMOUNT;
&nbsp;
var buffer = new Buffer(initialSize);
var size = 0;
&nbsp;
this.writable = true;
this.readable = false;
&nbsp;
this.size = function() {
return size;
};
&nbsp;
this.maxSize = function() {
return buffer.length;
};
&nbsp;
this.getContents = function(length) {
if(!size) return false;
&nbsp;
var data = new Buffer(Math.min(length || size, size));
buffer.copy(data, 0, 0, data.length);
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if(data.length &lt; size)
<span class="cstat-no" title="statement not covered" > buffer.copy(buffer, 0, data.length);</span>
&nbsp;
size -= data.length;
&nbsp;
return data;
};
&nbsp;
this.getContentsAsString = function(encoding, length) {
if(!size) return false;
&nbsp;
var data = buffer.toString(encoding || "utf8", 0, Math.min(length || size, size));
var dataLength = Buffer.byteLength(data);
&nbsp;
if(dataLength &lt; size)
buffer.copy(buffer, 0, dataLength);
&nbsp;
size -= dataLength;
return data;
};
&nbsp;
var increaseBufferIfNecessary = function(incomingDataSize) {
if((buffer.length - size) &lt; incomingDataSize) {
var factor = Math.ceil((incomingDataSize - (buffer.length - size)) / incrementAmount);
&nbsp;
var newBuffer = new Buffer(buffer.length + (incrementAmount * factor));
buffer.copy(newBuffer, 0, 0, size);
buffer = newBuffer;
}
};
&nbsp;
this.write = function(data, encoding, callback) {
if(!that.writable) return;
&nbsp;
if(Buffer.isBuffer(data)) {
increaseBufferIfNecessary(data.length);
data.copy(buffer, size, 0);
size += data.length;
}
else {
data = data + "";
increaseBufferIfNecessary(Buffer.byteLength(data));
buffer.write(data, size, encoding || "utf8");
size += Buffer.byteLength(data);
}
<span class="missing-if-branch" title="if path not taken" >I</span>if(typeof callback === "function") { <span class="cstat-no" title="statement not covered" >callback() ;}</span>
};
&nbsp;
this.end = function() {
var args = Array.prototype.slice.apply(arguments);
<span class="missing-if-branch" title="else path not taken" >E</span>if(args.length) that.write.apply(that, args);
that.emit('finish');
that.destroy();
};
&nbsp;
this.destroySoon = this.destroy = function() {
that.writable = false;
that.emit("close");
};
};
util.inherits(WritableStreamBuffer, stream.Stream);
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 01 2015 04:16:19 GMT+0000 (UTC)</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>