Skip to content

Instantly share code, notes, and snippets.

@tomasevich
Last active May 10, 2021 08:52
Show Gist options
  • Save tomasevich/5e42a97cab516f0792d46f68cd941c20 to your computer and use it in GitHub Desktop.
Save tomasevich/5e42a97cab516f0792d46f68cd941c20 to your computer and use it in GitHub Desktop.
node js: read JSON file from URL like object
var request = require ('request')

request ({
	url: 'https://raw.githubusercontent.com/rateljs/plugin/master/package.json',
	json: true
}, (error, response, body) => {
	!error && response.statusCode === 200
		? log (body)
		: log (error)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment