Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stringstream

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stringstream - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

.travis.yml

17

package.json
{
"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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc