伊谢尔伦2017-04-17 15:57:18
Wait until redis is ready before sending
client.on('ready',function(err){
https.get('https://encrypted.google.com', (res) => {
// console.log('statusCode:', res.statusCode);
// console.log('headers:', res.headers);
var rawData = '';
res.on('data', (chunk) => {
rawData += chunk
});
res.on('end', () => {
client.set('data', rawData, redis.print);
client.get('data', redis.print);
})
}).on('error', (e) => {
console.error(e);
});
console.log('ready');
});