package
super tiny http library
npm install tiny-networkGitHub-flavored package documentation.
Across all versions, last 30 days.
53 in 30 days
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
7.0 kB
Includes dependencies.
super tiny http library
$ npm install tiny-networkconst { get, readStream } = require('tiny-network');
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('tiny-network');
(async () => {
const response = await get('https://httpbin.org/get');
console.log(response.statusCode);
const body = await readStream(response);
console.log(JSON.parse(body));
})();$ npm installThis work is licensed under the MIT license.