JSPM

  • Created
  • Published
  • Downloads 1982975
  • Score
    100M100P100Q189855F
  • License SEE LICENSE IN LICENSE.md

Ultra-simple, lightweight, dependency-free Node.JS HTTP request client

Package Exports

  • phin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (phin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

phin logo


The ultra-lightweight Node.js HTTP client

Full documentation | GitHub | NPM

Simple Usage

const p = require('phin')

p('https://ethanent.me', (err, res) => {
    if (!err) console.log(res.body)
})

Installation

npm install phin

Why 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.6% smaller than request lightweight.

Request is over 6MB in size. phin is just 25KB in size.

Quick Demos

Simple POST:

p({
    url: 'https://ethanent.me',
    method: 'POST',
    data: {
        'hey': 'hi'
    }
})

Promisified:

const p = require('phin').promisified
;(async () => {
    const res = await p({
        url: 'https://ethanent.me'
    })

    console.log(res.body)
})()

Documentation

See the phin documentation.

phin has util.promisify support. The promisified library can also be accessed with require('phin').promisified!