Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
4
node_modules/stringstream/.travis.yml
generated
vendored
Normal file
4
node_modules/stringstream/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 0.4
|
||||
- 0.6
|
22
node_modules/stringstream/LICENSE.txt
generated
vendored
Normal file
22
node_modules/stringstream/LICENSE.txt
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2012 Michael Hart (michael.hart.au@gmail.com)
|
||||
|
||||
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.
|
38
node_modules/stringstream/README.md
generated
vendored
Normal file
38
node_modules/stringstream/README.md
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Decode streams into strings The Right Way(tm)
|
||||
|
||||
```javascript
|
||||
var fs = require('fs')
|
||||
var zlib = require('zlib')
|
||||
var strs = require('stringstream')
|
||||
|
||||
var utf8Stream = fs.createReadStream('massiveLogFile.gz')
|
||||
.pipe(zlib.createGunzip())
|
||||
.pipe(strs('utf8'))
|
||||
```
|
||||
|
||||
No need to deal with `setEncoding()` weirdness, just compose streams
|
||||
like they were supposed to be!
|
||||
|
||||
Handles input and output encoding:
|
||||
|
||||
```javascript
|
||||
// Stream from utf8 to hex to base64... Why not, ay.
|
||||
var hex64Stream = fs.createReadStream('myFile')
|
||||
.pipe(strs('utf8', 'hex'))
|
||||
.pipe(strs('hex', 'base64'))
|
||||
```
|
||||
|
||||
Also deals with `base64` output correctly by aligning each emitted data
|
||||
chunk so that there are no dangling `=` characters:
|
||||
|
||||
```javascript
|
||||
var stream = fs.createReadStream('myFile').pipe(strs('base64'))
|
||||
|
||||
var base64Str = ''
|
||||
|
||||
stream.on('data', function(data) { base64Str += data })
|
||||
stream.on('end', function() {
|
||||
console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding()
|
||||
console.log('Original file is: ' + new Buffer(base64Str, 'base64'))
|
||||
})
|
||||
```
|
27
node_modules/stringstream/example.js
generated
vendored
Normal file
27
node_modules/stringstream/example.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
var fs = require('fs')
|
||||
var zlib = require('zlib')
|
||||
var strs = require('stringstream')
|
||||
|
||||
var utf8Stream = fs.createReadStream('massiveLogFile.gz')
|
||||
.pipe(zlib.createGunzip())
|
||||
.pipe(strs('utf8'))
|
||||
|
||||
utf8Stream.pipe(process.stdout)
|
||||
|
||||
// Stream from utf8 to hex to base64... Why not, ay.
|
||||
var hex64Stream = fs.createReadStream('myFile')
|
||||
.pipe(strs('utf8', 'hex'))
|
||||
.pipe(strs('hex', 'base64'))
|
||||
|
||||
hex64Stream.pipe(process.stdout)
|
||||
|
||||
// Deals with base64 correctly by aligning chunks
|
||||
var stream = fs.createReadStream('myFile').pipe(strs('base64'))
|
||||
|
||||
var base64Str = ''
|
||||
|
||||
stream.on('data', function(data) { base64Str += data })
|
||||
stream.on('end', function() {
|
||||
console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding()
|
||||
console.log('Original file is: ' + new Buffer(base64Str, 'base64'))
|
||||
})
|
18
node_modules/stringstream/package.json
generated
vendored
Normal file
18
node_modules/stringstream/package.json
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "stringstream",
|
||||
"version": "0.0.6",
|
||||
"description": "Encode and decode streams into string streams",
|
||||
"author": "Michael Hart <michael.hart.au@gmail.com> (http://github.com/mhart)",
|
||||
"main": "stringstream.js",
|
||||
"keywords": [
|
||||
"string",
|
||||
"stream",
|
||||
"base64",
|
||||
"gzip"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mhart/StringStream.git"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
102
node_modules/stringstream/stringstream.js
generated
vendored
Normal file
102
node_modules/stringstream/stringstream.js
generated
vendored
Normal file
|
@ -0,0 +1,102 @@
|
|||
var util = require('util')
|
||||
var Stream = require('stream')
|
||||
var StringDecoder = require('string_decoder').StringDecoder
|
||||
|
||||
module.exports = StringStream
|
||||
module.exports.AlignedStringDecoder = AlignedStringDecoder
|
||||
|
||||
function StringStream(from, to) {
|
||||
if (!(this instanceof StringStream)) return new StringStream(from, to)
|
||||
|
||||
Stream.call(this)
|
||||
|
||||
if (from == null) from = 'utf8'
|
||||
|
||||
this.readable = this.writable = true
|
||||
this.paused = false
|
||||
this.toEncoding = (to == null ? from : to)
|
||||
this.fromEncoding = (to == null ? '' : from)
|
||||
this.decoder = new AlignedStringDecoder(this.toEncoding)
|
||||
}
|
||||
util.inherits(StringStream, Stream)
|
||||
|
||||
StringStream.prototype.write = function(data) {
|
||||
if (!this.writable) {
|
||||
var err = new Error('stream not writable')
|
||||
err.code = 'EPIPE'
|
||||
this.emit('error', err)
|
||||
return false
|
||||
}
|
||||
if (this.fromEncoding) {
|
||||
if (Buffer.isBuffer(data) || typeof data === 'number') data = data.toString()
|
||||
data = new Buffer(data, this.fromEncoding)
|
||||
}
|
||||
var string = this.decoder.write(data)
|
||||
if (string.length) this.emit('data', string)
|
||||
return !this.paused
|
||||
}
|
||||
|
||||
StringStream.prototype.flush = function() {
|
||||
if (this.decoder.flush) {
|
||||
var string = this.decoder.flush()
|
||||
if (string.length) this.emit('data', string)
|
||||
}
|
||||
}
|
||||
|
||||
StringStream.prototype.end = function() {
|
||||
if (!this.writable && !this.readable) return
|
||||
this.flush()
|
||||
this.emit('end')
|
||||
this.writable = this.readable = false
|
||||
this.destroy()
|
||||
}
|
||||
|
||||
StringStream.prototype.destroy = function() {
|
||||
this.decoder = null
|
||||
this.writable = this.readable = false
|
||||
this.emit('close')
|
||||
}
|
||||
|
||||
StringStream.prototype.pause = function() {
|
||||
this.paused = true
|
||||
}
|
||||
|
||||
StringStream.prototype.resume = function () {
|
||||
if (this.paused) this.emit('drain')
|
||||
this.paused = false
|
||||
}
|
||||
|
||||
function AlignedStringDecoder(encoding) {
|
||||
StringDecoder.call(this, encoding)
|
||||
|
||||
switch (this.encoding) {
|
||||
case 'base64':
|
||||
this.write = alignedWrite
|
||||
this.alignedBuffer = new Buffer(3)
|
||||
this.alignedBytes = 0
|
||||
break
|
||||
}
|
||||
}
|
||||
util.inherits(AlignedStringDecoder, StringDecoder)
|
||||
|
||||
AlignedStringDecoder.prototype.flush = function() {
|
||||
if (!this.alignedBuffer || !this.alignedBytes) return ''
|
||||
var leftover = this.alignedBuffer.toString(this.encoding, 0, this.alignedBytes)
|
||||
this.alignedBytes = 0
|
||||
return leftover
|
||||
}
|
||||
|
||||
function alignedWrite(buffer) {
|
||||
var rem = (this.alignedBytes + buffer.length) % this.alignedBuffer.length
|
||||
if (!rem && !this.alignedBytes) return buffer.toString(this.encoding)
|
||||
|
||||
var returnBuffer = new Buffer(this.alignedBytes + buffer.length - rem)
|
||||
|
||||
this.alignedBuffer.copy(returnBuffer, 0, 0, this.alignedBytes)
|
||||
buffer.copy(returnBuffer, this.alignedBytes, 0, buffer.length - rem)
|
||||
|
||||
buffer.copy(this.alignedBuffer, 0, buffer.length - rem, buffer.length)
|
||||
this.alignedBytes = rem
|
||||
|
||||
return returnBuffer.toString(this.encoding)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue