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.
- Host: GitHub
- URL: https://github.com/lambda2/get-content
- Owner: lambda2
- License: mit
- Created: 2016-06-24T19:55:56.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-05T07:51:18.000Z (almost 10 years ago)
- Last Synced: 2025-10-14T04:23:42.195Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 129 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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