The ultra-lightweight Node.js HTTP client
const p =const res = awaitconsole
Note that the above should be in an async context! phin also provides an unpromisified version of the library.
npm install phin
phin is trusted by some really important projects. The hundreds of contributors at Less, for example, depend on phin as part of their development process.
Also, phin is super lightweight. Like 99.8% smaller than request lightweight. To compare to other libraries, see phin vs. the Competition.
const p = unpromisified
Simple parsing of JSON:
// (In async function in this case.)const res = awaitconsole
const ppostjson = p// In async function...const res = await// ^ An options object could also be used here to set other options.// Do things with res.body?
Custom Core HTTP Options
phin allows you to set core HTTP options.
There's a lot more which can be done with the phin library.
phin vs. the Competition
phin is a very lightweight library, yet it contains all of the common HTTP client features included in competing libraries!
Here's a size comparison table: