Quantcast
Channel: Write a stream to a string and return it from a function - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by dev07 for Write a stream to a string and return it from a function

do this var http = require("http") module.exports = { shorten: function(url,cb) { var resData = '' http.get('[tinyurl api endpoint]' + encodeURIComponent(url), (res) => { res.setEncoding('utf8')...

View Article



Answer by Kanad Chourasia for Write a stream to a string and return it from a...

Try to use with callback function shorten: function(url,callback) { var resData = '' http.get('[tinyurl api endpoint]' + encodeURIComponent(url), (res) => { res.setEncoding('utf8') res.on('data',...

View Article

Write a stream to a string and return it from a function

As part of a program I am writing, I'd like to have a helper function that shortens some long URLs that are created. I found this package: and am attempting to change the code so that it simply stores...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images