Last active
September 23, 2016 16:44
-
-
Save BorePlusPlus/c9186c8feb9902f84da3e35f313a43a8 to your computer and use it in GitHub Desktop.
Missing bytes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Client :: ready | |
Stat: Stats { | |
mode: 33206, | |
permissions: 33206, | |
uid: undefined, | |
gid: undefined, | |
size: 1172943, | |
atime: 1473984262, | |
mtime: 1473984262 } | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 32768 thisPool.length: 32768 | |
bytesRead: 26063 thisPool.length: 32768 | |
bytesRead: 0 thisPool.length: 32768 | |
buffer.length 1172943 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Client :: ready | |
Stat: Stats { | |
mode: 33206, | |
permissions: 33206, | |
uid: undefined, | |
gid: undefined, | |
size: 1172943, | |
atime: 1473984262, | |
mtime: 1473984262 } | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 65535 thisPool.length: 65536 | |
bytesRead: 58831 thisPool.length: 65536 | |
bytesRead: 0 thisPool.length: 65536 | |
buffer.length 1172926 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var Client = require('ssh2').Client; | |
var conn = new Client(); | |
conn.on('ready', function() { | |
console.log('Client :: ready'); | |
conn.sftp(function(err, sftp) { | |
if (err) throw err; | |
sftp.stat('directory/file.zip', function (err, stat) { | |
if (err) throw err; | |
console.log('Stat:', stat); | |
}); | |
// BEFORE | |
// var stream = sftp.createReadStream('directory/file.zip', {}); | |
// AFTER | |
var stream = sftp.createReadStream('directory/file.zip', { highWaterMark: 32 * 1024 }); | |
var chunks = []; | |
stream.on('data', function(chunk) { | |
chunks.push(chunk); | |
}); | |
stream.on('end', function () { | |
var buf = Buffer.concat(chunks); | |
console.log('buffer.length', buf.length); | |
conn.end(); | |
}); | |
}); | |
}).connect({ | |
host: 'somewhere.example.com', | |
port: 22, | |
username: 'foo', | |
password: 'bar' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment