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.1 to 0.0.2

2

package.json
{
"name": "stringstream",
"version": "0.0.1",
"version": "0.0.2",
"description": "Encode and decode streams into string streams",

@@ -5,0 +5,0 @@ "main": "stringstream.js",

@@ -8,3 +8,3 @@ # Decode streams into strings The Right Way(tm)

var stream = fs.createReadStream('massiveLogFile.gz')
var utf8Stream = fs.createReadStream('massiveLogFile.gz')
.pipe(zlib.createGunzip())

@@ -20,3 +20,3 @@ .pipe(strs('utf8'))

```javascript
// Stream from utf8 to hex to base64... Why not ay.
// Stream from utf8 to hex to base64... Why not, ay.
fs.createReadStream('myFile').pipe(strs('utf8', 'hex')).pipe(strs('hex', 'base64'))

@@ -29,3 +29,3 @@ ```

```javascript
var stream = fs.createReadStream('massiveLogFile.gz').pipe(strs('base64'))
var stream = fs.createReadStream('myHugeFile').pipe(strs('base64'))

@@ -36,4 +36,4 @@ var fileStr = ''

stream.on('end', function() {
console.log('My base64 encoded file is: ' + fileStr)
console.log('My base64 encoded file is: ' + fileStr) // Wouldn't work with setEncoding()
})
```

@@ -14,4 +14,4 @@ var util = require('util')

this.readable = true
this.writable = true
this.readable = this.writable = true
this.paused = false
this.toEncoding = (typeof to === 'undefined' ? from : to)

@@ -30,11 +30,33 @@ this.fromEncoding = (typeof to === 'undefined' ? '' : from)

if (string.length) this.emit('data', string)
return !this.paused
}
StringStream.prototype.end = function() {
StringStream.prototype.flush = function() {
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) {

@@ -41,0 +63,0 @@ StringDecoder.call(this, encoding)

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