Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http collect #419

Open
artivilla opened this issue Mar 2, 2016 · 1 comment
Open

http collect #419

artivilla opened this issue Mar 2, 2016 · 1 comment

Comments

@artivilla
Copy link

I've tried this in a few different ways. Here's one implementation and I keep getting the same error. Any suggestions? The same thing seems to work with the bl library, so I'm not sure what's the difference here.

'use strict'
let http = require('http')
let concat = require('concat-stream')

http.get(process.argv[2], (res) => {
  var result
  res.pipe(concat(function (data) {
    result = data.toString()
    console.log(result)
  }))
  res.on('end', console.log(result))
  res.on('error', console.log('thowing an err'))
})

I'm guessing a 'throw new TypeError('listener must be a function');' error.

@artivilla artivilla changed the title http colllect http collect Mar 2, 2016
@MystK
Copy link

MystK commented Mar 29, 2016

Have you tried using ES5 functions instead of arrow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants