Sha256: 7831af526660976186b89744e5819ebc2c1ff609c2bf25e01d8262d8d5324128

Contents?: true

Size: 814 Bytes

Versions: 142

Compression:

Stored size: 814 Bytes

Contents

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'))
})

Version data entries

142 entries across 120 versions & 17 rubygems

Version Path
ilog-0.4.1 node_modules/stringstream/example.js
ilog-0.4.0 node_modules/stringstream/example.js
ilog-0.3.3 node_modules/stringstream/example.js
optimacms-0.4.3 spec/dummy/node_modules/stringstream/example.js
optimacms-0.4.2 spec/dummy/node_modules/stringstream/example.js
locomotivecms-3.4.0 app/javascript/node_modules/stringstream/example.js
cortex-0.1.3 spec/dummy/node_modules/stringstream/example.js
dragonfly_puppeteer-0.1.0 node_modules/stringstream/example.js
affiliator-0.2.1 node_modules/fsevents/node_modules/stringstream/example.js
lanes-0.8.0 node_modules/stringstream/example.js
lanes-0.8.0 node_modules/fsevents/node_modules/stringstream/example.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/request/node_modules/stringstream/example.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/request/node_modules/stringstream/example.js
node-compiler-0.9.1 vendor/node/deps/npm/node_modules/request/node_modules/stringstream/example.js
node-compiler-0.9.0 vendor/node-v7.2.1/deps/npm/node_modules/request/node_modules/stringstream/example.js
select_all-rails-0.3.1 node_modules/stringstream/example.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/request/node_modules/stringstream/example.js
node-compiler-0.8.0 vendor/node-v7.2.0/deps/npm/node_modules/request/node_modules/stringstream/example.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/request/node_modules/stringstream/example.js
node-compiler-0.7.0 vendor/node-v7.1.0/deps/npm/node_modules/request/node_modules/stringstream/example.js