↧
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 ArticleAnswer 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 ArticleWrite 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