mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
# add dist
This commit is contained in:
22
ng2-components/ng2-alfresco-documentslist/dist/node_modules/stringstream/LICENSE.txt
generated
vendored
Normal file
22
ng2-components/ng2-alfresco-documentslist/dist/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
ng2-components/ng2-alfresco-documentslist/dist/node_modules/stringstream/README.md
generated
vendored
Normal file
38
ng2-components/ng2-alfresco-documentslist/dist/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
ng2-components/ng2-alfresco-documentslist/dist/node_modules/stringstream/example.js
generated
vendored
Normal file
27
ng2-components/ng2-alfresco-documentslist/dist/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'))
|
||||
})
|
77
ng2-components/ng2-alfresco-documentslist/dist/node_modules/stringstream/package.json
generated
vendored
Normal file
77
ng2-components/ng2-alfresco-documentslist/dist/node_modules/stringstream/package.json
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"stringstream@~0.0.4",
|
||||
"/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/browser-sync/node_modules/request"
|
||||
]
|
||||
],
|
||||
"_from": "stringstream@>=0.0.4 <0.1.0",
|
||||
"_id": "stringstream@0.0.5",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/stringstream",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
"email": "michael.hart.au@gmail.com",
|
||||
"name": "hichaelmart"
|
||||
},
|
||||
"_npmVersion": "2.14.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "stringstream",
|
||||
"raw": "stringstream@~0.0.4",
|
||||
"rawSpec": "~0.0.4",
|
||||
"scope": null,
|
||||
"spec": ">=0.0.4 <0.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browser-sync/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
|
||||
"_shasum": "4e484cd4de5a0bbbee18e46307710a8a81621878",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "stringstream@~0.0.4",
|
||||
"_where": "/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/browser-sync/node_modules/request",
|
||||
"author": {
|
||||
"email": "michael.hart.au@gmail.com",
|
||||
"name": "Michael Hart",
|
||||
"url": "http://github.com/mhart"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mhart/StringStream/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Encode and decode streams into string streams",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "4e484cd4de5a0bbbee18e46307710a8a81621878",
|
||||
"tarball": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz"
|
||||
},
|
||||
"gitHead": "1efe3bf507bf3a1161f8473908b60e881d41422b",
|
||||
"homepage": "https://github.com/mhart/StringStream#readme",
|
||||
"keywords": [
|
||||
"string",
|
||||
"stream",
|
||||
"base64",
|
||||
"gzip"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "stringstream.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "michael.hart.au@gmail.com",
|
||||
"name": "hichaelmart"
|
||||
}
|
||||
],
|
||||
"name": "stringstream",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mhart/StringStream.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.0.5"
|
||||
}
|
102
ng2-components/ng2-alfresco-documentslist/dist/node_modules/stringstream/stringstream.js
generated
vendored
Normal file
102
ng2-components/ng2-alfresco-documentslist/dist/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)) 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)
|
||||
}
|
Reference in New Issue
Block a user