https://github.com/lsongdev/tinyh
super tiny network library
https://github.com/lsongdev/tinyh
http networking tinyhttp web
Last synced: 12 months ago
JSON representation
super tiny network library
- Host: GitHub
- URL: https://github.com/lsongdev/tinyh
- Owner: lsongdev
- License: mit
- Created: 2019-09-10T01:57:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T09:17:28.000Z (about 3 years ago)
- Last Synced: 2025-02-13T22:23:50.039Z (12 months ago)
- Topics: http, networking, tinyhttp, web
- Language: JavaScript
- Homepage: https://npmjs.org/tinyh
- Size: 6.84 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## tinyh
> super tiny http library
[](https://travis-ci.org/song940/tinyh)
### Installation
```bash
$ npm install tinyh
```
### Example
```js
const { get, readStream } = require('tinyh');
Promise
.resolve()
.then(() => get('https://httpbin.org/get'))
.then(ensureStatusCode(200))
.then(readStream)
.then(JSON.parse)
.then(response => {
console.log(response);
});
```
Async/Await
```js
const { get, readStream } = require('tinyh');
(async () => {
const response = await get('https://httpbin.org/get');
console.log(response.statusCode);
const body = await readStream(response);
console.log(JSON.parse(body));
})();
```
### Contributing
- Fork this Repo first
- Clone your Repo
- Install dependencies by `$ npm install`
- Checkout a feature branch
- Feel free to add your features
- Make sure your features are fully tested
- Publish your local branch, Open a pull request
- Enjoy hacking <3
### MIT
This work is licensed under the [MIT license](./LICENSE).
---