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

haporedrive-sdk

v0.0.4

Published

SDK oficial para interactuar con la API de HaporeLabs Drive

Readme

HaporeDrive CDN SDK

SDK oficial para interactuar con el servicio CDN de HaporeLabs Drive.

Instalación

npm install haporedrive-sdk

Importación

// Importación del cliente CDN
import { HaporeDriveCDN } from 'haporedrive-sdk';

Uso

Inicialización

import { HaporeDriveCDN } from 'haporedrive-sdk';

// Crear cliente CDN
const cdnClient = new HaporeDriveCDN({
  baseUrl: 'https://tu-dominio.com'
});

Métodos Disponibles

| Método | Descripción | Parámetros | Tipo de Retorno | |--------|-------------|------------|-----------------| | getFolderContent | Obtiene el contenido de una carpeta CDN | path: string - Ruta completa de la carpeta en formato "categoria/nombre" | Promise<CDNFolderContent> | | listFiles | Obtiene todos los archivos CDN | folder?: string - (Opcional) Filtrar por carpeta específica | Promise<CDNFilesResponse> |

Ejemplo completo de uso

import { HaporeDriveCDN, APIError, NetworkError } from 'haporedrive-sdk';

async function ejemploUso() {
  // Crear cliente CDN
  const cdnClient = new HaporeDriveCDN({
    baseUrl: 'https://tu-dominio.com',
    timeout: 5000
  });

  try {
    // Obtener contenido de una carpeta
    console.log('Obteniendo contenido de la carpeta...');
    const content = await cdnClient.getFolderContent('documentos/proyectos');
    console.log('Contenido de la carpeta:', content);
    
    // Listar todos los archivos
    console.log('Listando todos los archivos...');
    const allFiles = await cdnClient.listFiles();
    console.log('Total de archivos:', allFiles.count);
    
    // Listar archivos de una carpeta específica
    console.log('Listando archivos de una carpeta específica...');
    const folderFiles = await cdnClient.listFiles('documentos');
    console.log('Archivos en la carpeta documentos:', folderFiles.count);
    
  } catch (error) {
    if (error instanceof APIError) {
      console.error(`Error de API: ${error.message} (Código: ${error.status})`);
    } else if (error instanceof NetworkError) {
      console.error(`Error de red: ${error.message}`);
    } else {
      console.error(`Error desconocido: ${error.message}`);
    }
  }
}

// Ejecutar ejemplo
ejemploUso();

Uso de las URLs del CDN

El CDN proporciona URLs directas a los archivos que pueden ser accedidos directamente:

// Obtener contenido de una carpeta
const content = await cdnClient.getFolderContent('documentos/proyectos');

// Usar las URLs directamente en tu aplicación
content.files.forEach(file => {
  console.log(`URL del archivo: ${file.url}`);
  // Puedes usar esta URL directamente en <img src>, <a href>, etc.
});

Tipos Disponibles

El SDK incluye tipos TypeScript completos para todos los objetos devueltos por la API:

Manejo de Errores

El SDK proporciona clases de error específicas:

import { APIError, NetworkError, ValidationError } from 'haporedrive-sdk';

try {
  const content = await cdnClient.getFolderContent('categoria/nombre');
} catch (error) {
  if (error instanceof APIError) {
    console.log(`Error de API: ${error.message} (Código: ${error.status})`);
  } else if (error instanceof NetworkError) {
    console.log(`Error de red: ${error.message}`);
  } else if (error instanceof ValidationError) {
    console.log(`Error de validación: ${error.message}`);
  } else {
    console.log(`Error desconocido: ${error.message}`);
  }
}

Desarrollo

Construir el proyecto

npm run build

Modo desarrollo (watch)

npm run dev

Ejecutar pruebas

npm test

Licencia

MIT