get-content

1.0.2 • Public • Published

get-content NPM version Build Status Dependency Status Coverage percentage

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

Package Sidebar

Install

npm i get-content

Weekly Downloads

105

Version

1.0.2

License

MIT

Last publish

Collaborators

  • lambda2