get-content
v1.0.2
Published
Fetch content of a url, a file, or even UNIX sockets.
Downloads
448
Maintainers
Readme
get-content
Fetch content of a url, a file, or even UNIX sockets.;
Install
$ npm install --save get-content
Usage
const { linkType, get } = require("get-content");
const url = 'http://andral.kiwi';
const type = linkType(url);
console.log(type); // 'url'
get(url).then((pageContent) => {
console.log(pageContent); // <html>\n\t<head>\n...'
}).catch((err) => {
console.warn(err); // Something happen !
});
get('./README.md').then(function(response){
console.log(response); /* content of README.md file */
});
License
MIT © Andre Aubin