stringstream
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "stringstream", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Encode and decode streams into string streams", | ||
"author": "Michael Hart <michael.hart.au@gmail.com> (http://github.com/mhart)", | ||
"main": "stringstream.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"homepage": "https://github.com/mhart/StringStream", | ||
"keywords": [ | ||
"string", | ||
"stream", | ||
"base64", | ||
"gzip" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mhart/StringStream.git" | ||
}, | ||
"author": "Michael Hart <michael.hart.au@gmail.com> http://twitter.com/hichaelmart", | ||
"license": "BSD" | ||
"license": "MIT" | ||
} |
# Decode streams into strings The Right Way(tm) | ||
```javascript | ||
fs = require('fs') | ||
zlib = require('zlib') | ||
strs = require('stringstream') | ||
var fs = require('fs') | ||
var zlib = require('zlib') | ||
var strs = require('stringstream') | ||
@@ -20,3 +20,5 @@ var utf8Stream = fs.createReadStream('massiveLogFile.gz') | ||
// Stream from utf8 to hex to base64... Why not, ay. | ||
fs.createReadStream('myFile').pipe(strs('utf8', 'hex')).pipe(strs('hex', 'base64')) | ||
var hex64Stream = fs.createReadStream('myFile') | ||
.pipe(strs('utf8', 'hex')) | ||
.pipe(strs('hex', 'base64')) | ||
``` | ||
@@ -28,10 +30,11 @@ | ||
```javascript | ||
var stream = fs.createReadStream('myHugeFile').pipe(strs('base64')) | ||
var stream = fs.createReadStream('myFile').pipe(strs('base64')) | ||
var fileStr = '' | ||
var base64Str = '' | ||
stream.on('data', function(data) { fileStr += data }) | ||
stream.on('data', function(data) { base64Str += data }) | ||
stream.on('end', function() { | ||
console.log('My base64 encoded file is: ' + fileStr) // Wouldn't work with setEncoding() | ||
console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding() | ||
console.log('Original file is: ' + new Buffer(base64Str, 'base64')) | ||
}) | ||
``` |
@@ -13,8 +13,8 @@ var util = require('util') | ||
from = from || 'utf8' | ||
if (from == null) from = 'utf8' | ||
this.readable = this.writable = true | ||
this.paused = false | ||
this.toEncoding = (typeof to === 'undefined' ? from : to) | ||
this.fromEncoding = (typeof to === 'undefined' ? '' : from) | ||
this.toEncoding = (to == null ? from : to) | ||
this.fromEncoding = (to == null ? '' : from) | ||
this.decoder = new AlignedStringDecoder(this.toEncoding) | ||
@@ -21,0 +21,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
5396
7
0
103
39
0
80
1