An open API service indexing awesome lists of open source software.

https://github.com/lambda2/get-content

Fetch content of a url, a file, or even UNIX sockets with promises.
https://github.com/lambda2/get-content

Last synced: 5 months ago
JSON representation

Fetch content of a url, a file, or even UNIX sockets with promises.

Awesome Lists containing this project

README

          

# get-content [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url]
> Fetch content of a url, a file, or even UNIX sockets.;

## Install

```sh
$ npm install --save get-content
```

## Usage

```js
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); // \n\t\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](http://andral.kiwi)

[npm-image]: https://badge.fury.io/js/get-content.svg
[npm-url]: https://npmjs.org/package/get-content
[travis-image]: https://travis-ci.org/lambda2/get-content.svg?branch=master
[travis-url]: https://travis-ci.org/lambda2/get-content
[daviddm-image]: https://david-dm.org/lambda2/get-content.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/lambda2/get-content
[coveralls-image]: https://coveralls.io/repos/github/lambda2/get-content/badge.svg?branch=master
[coveralls-url]: https://coveralls.io/github/lambda2/get-content?branch=master