npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hyperquest-promise

v0.1.1

Published

[hyperquest](https://github.com/substack/hyperquest) promise support. Node.js and browser compatible http request API

Downloads

291

Readme

Build Status Dependencies

Hyperquest returning Promises

hyperquest returning promises

Same API, same code, both in browser and node.js.

For those not familiar, this is library for making requests that will work both in node.js and browser thanks to browserify or similar bundler.

Install

npm install --save hyperquest-promise

Usage

Use async/await for shorter syntax. Resolves with a Request object and request.data is a Buffer. By default encodes text as binary.

import { get } from 'hyperquest-promise'

(async () => {
  const {buffer} = await get('https://foo.com/f/bar.jpg')
  writeFileSync('bar.jpg', buffer)
})();

export async function getSpotifyProfile() {
  const response = await get('https://api.spotify.com/v1/me/playlists', 
    {headers: {Authorization: `Bearer ${THE_TOKEN}`}})
  return (!response || !response.data) ? null || JSON.parse(response.data.toString())
}

API documentation

For API documentation , please go to hyperquest or request.

The API is the same as hyperquest with the only difference that methods will return a Promise.

Options signature

  • url?: string:
  • scheme?: string:
  • method?: string:
  • host?: string:
  • port?: string:
  • encoding?: string:
  • path?: string:
  • agent?: string | false:
  • headers?: Headers:
  • withCredentials?: any:
  • localAddress?: any:
  • pfx?: any:
  • key?: any:
  • cert?: any:
  • ca?: any:
  • ciphers?: any:
  • rejectUnauthorized?: any:
  • secureProtocol?: any: