Skip to content

lsongdev/tinyh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinyh

super tiny http library

Build Status

Installation

$ npm install tinyh

Example

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

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.


About

super tiny network library

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published