REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.04 KB
Close
/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/node_modules/request/node_modules/stringstream/README.md
Text
Base64
# 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')) }) ```
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 7
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.npmignore
96 B
lrw-r--r--
2021-09-28 09:36:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
.travis.yml
43 B
lrw-r--r--
2021-09-28 09:36:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
example.js
814 B
lrw-r--r--
2021-09-28 09:36:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LICENSE.txt
1.06 KB
lrw-r--r--
2021-09-28 09:36:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
package.json
2.19 KB
lrw-r--r--
2021-09-28 09:36:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
README.md
1.04 KB
lrw-r--r--
2021-09-28 09:36:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
stringstream.js
2.73 KB
lrw-r--r--
2021-09-28 09:36:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).