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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gosish/hf

v2.1.0

Published

A modern, robust, and high-performance HTTP fetcher with caching, circuit breaker, and plugins. A super-powered Axios.

Readme

@gosish/hf (Hyper Fetcher) est une bibliothèque de requêtes HTTP légère mais puissante, conçue pour les applications modernes. Elle combine la simplicité de l'API fetch avec les fonctionnalités indispensables des bibliothèques comme Axios, le tout dans un paquet robuste et entièrement typé.

Fonctionnalités Clés

  • 🧠 Cache Intelligent Intégré : Mise en cache en mémoire avec une clé unique par requête pour des performances optimales.
  • ⛓️ Coupe-circuit (Circuit Breaker) : Protège votre application en cessant d'appeler les services qui sont en panne.
  • 🔌 Système de Plugins : Étendez les fonctionnalités avec des intercepteurs pour l'authentification, le logging, et plus encore.
  • Expérience Développeur Supérieure : API élégante avec des instances configurables (baseURL, headers), des raccourcis (.get, .post), et une gestion automatique du body.
  • 🔒 Entièrement Typé : Écrit en TypeScript pour une auto-complétion et une sécurité de type de premier ordre.
  • ⚡️ Ultra-Performant : Basé sur les standards modernes (fetch, Promise) pour un impact minimal sur les performances.

Installation

npm install @gosish/hf

Démarrage Rapide

Faire une simple requête GET est un jeu d'enfant.

import hf from '@gosish/hf';

async function getUser() {
  try {
    const user = await hf.get('https://jsonplaceholder.typicode.com/users/1');
    console.log(user.name); // Affiche "Leanne Graham"
  } catch (error) {
    console.error('La requête a échoué:', error);
  }
}

getUser();

(Note: pour plus de concision, l'instance par défaut est souvent importée sous l'alias hf)

Utilisation Avancée

La vraie puissance de @gosish/hf réside dans sa capacité à créer des instances pré-configurées.

Créer un Client d'API

Créez une instance avec une baseURL et des headers par défaut pour communiquer avec votre API.

import { HyperFetcher } from '@gosish/hf';

const apiClient = new HyperFetcher({
  baseURL: 'https://api.monservice.com/v1',
  headers: {
    'Authorization': 'Bearer VOTRE_TOKEN_API',
    'X-Client': 'gosish-hf'
  }
});

// Utilisez les raccourcis pour des requêtes propres et lisibles
async function getProducts() {
  // Fera une requête GET à https://api.monservice.com/v1/products
  const products = await apiClient.get('products');
  return products;
}

async function createProduct(newProduct) {
  // Fera une requête POST à https://api.monservice.com/v1/products
  // Le body est automatiquement converti en JSON et le Content-Type est ajouté
  const createdProduct = await apiClient.post('products', newProduct);
  return createdProduct;
}```

### Gestion du Cache

Contrôlez la durée de vie du cache pour chaque requête avec l'option `cacheTTL` (en millisecondes).

```javascript
// Les données de cette requête seront mises en cache pendant 5 minutes
const data = await apiClient.get('data/heavy-ressource', {
  cacheTTL: 300000 
});

Le Coupe-circuit (Circuit Breaker)

Le coupe-circuit est activé par défaut. Si une API commence à échouer de manière répétée (plus de 50% d'erreurs), @gosish/hf arrêtera d'envoyer des requêtes pendant 30 secondes pour la laisser récupérer et pour protéger votre application. Ce comportement est entièrement configurable.

Licence

Ce projet est sous licence MIT.