scramjetorg / scramjet

Public tracker for Scramjet Cloud Platform, a platform that bring data from many environments together.
https://www.scramjet.org
MIT License
253 stars 20 forks source link

Update example on home page now that request is deprecated? #91

Closed gregmsanderson closed 4 years ago

gregmsanderson commented 4 years ago

Hello,

I came across this project and tried the first example shown using StringStream which seems to work great.

However it seems the request package is deprecated. Maybe update the example to instead use axios, fetch etc?

request("https://api.example.org/v1/shows/list")

Thanks!

MichalCz commented 4 years ago

Yeah, I guess we should change it, preferably to something light...

I guess node-fetch would be best? Axios seems quite heavy?

gregmsanderson commented 4 years ago

node-fetch seems the smallest, from https://github.com/request/request/issues/3143 so if it does the same, sure, swap for that?

MichalCz commented 4 years ago

Yeah. I'll review the dependencies in examples too - I think there's some request mentions in other places.

fetch is already on www.scramjet.org - so I guess that's easiest to push some simple one liner to get the stream like:

StringStream.from(async () => (await fetch('https://example.org/some.csv')).body)

I'd need to test it first though...

MichalCz commented 4 years ago

Done and pushed. :)

Oh and at the same time, now this will work:

Scramjet.from(fetch('https://www.example.net/some/resource.txt'))

A small addition. 😄