Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

npm got

const got = require('got');

(async () => {
	try {
		const response = await got('https://sindresorhus.com');
		console.log(response.body);
		//=> '<!doctype html> ...'
	} catch (error) {
		console.log(error.response.body);
		//=> 'Internal server error ...'
	}
})();
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript execute powershell script 
Javascript :: module is not defined eslint 
Javascript :: how the filter() function works javascript 
Javascript :: vscode 
Javascript :: react render after data loaded 
Javascript :: normalize javascript 
Javascript :: oneerror javascript image 
Javascript :: pass parameter to handleclick react 
Javascript :: javascript date format mm/dd/yyyy 
Javascript :: remove .html from url express js 
Javascript :: js add animation to element 
Javascript :: remove part of string javascript 
Javascript :: window resize next js 
Javascript :: use style in react 
Javascript :: create url with query parameters javascript 
Javascript :: equivalent method load jquery with javascript 
Javascript :: print element by xpath javascript 
Javascript :: create a loop that runs through each item in an array 
Javascript :: puppeteer headless 
Javascript :: generate random string with javascript 
Javascript :: react promises 
Javascript :: find js 
Javascript :: js read file json 
Javascript :: get the whole value of a number javascript 
Javascript :: Map and Filter methods used together 
Javascript :: upload excel file using jquery ajax 
Javascript :: cors in node js 
Javascript :: react prevent form submission on enter key press inside inputs 
Javascript :: antd react native 
Javascript :: javascript reverse 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =