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

sdk-javipopopo

v3.0.1

Published

Our thanks to master javi

Readme

sdk-javipopopo v3.0.1

Javipopopo

About

A comprehensive SDK for making HTTP requests with support for authentication, file operations, and query parameter building. Optimized for speed, ease of use, and TypeScript support.

Our thanks to Master Javi

Installation

npm install sdk-javipopopo

or

yarn add sdk-javipopopo

Usage

1. Basic HTTP Requests (No Authentication)

import { sdkRequest, MethodsHttp } from "sdk-javipopopo";

const BASE_URL = "https://api.example.com/api/v2";

// GET request
const users = await sdkRequest(
  BASE_URL,
  "users",
  { method: MethodsHttp.GET }
);

// POST request
const newUser = await sdkRequest(
  BASE_URL,
  "users",
  {
    method: MethodsHttp.POST,
    body: JSON.stringify({ name: "John Doe", email: "[email protected]" }),
    headers: { 'Content-Type': 'application/json' }
  }
);

2. Authenticated HTTP Requests

import { sdkAuthRequest, MethodsHttp } from "sdk-javipopopo";

const BASE_URL = process.env.API_BASE_URL || "https://api.example.com/api/v2";
const token = process.env.API_TOKEN;

// GET request with authentication
const profile = await sdkAuthRequest(
  BASE_URL,
  "users/profile",
  { method: MethodsHttp.GET, cache: "no-store" },
  token
);

// POST request with authentication
const product = await sdkAuthRequest(
  BASE_URL,
  "products",
  {
    method: MethodsHttp.POST,
    body: JSON.stringify({ name: "New Product", price: 19.99 }),
    headers: { 'Content-Type': 'application/json' }
  },
  token
);

// PUT request with authentication
const updatedUser = await sdkAuthRequest(
  BASE_URL,
  "users/123",
  {
    method: MethodsHttp.PUT,
    body: JSON.stringify({ name: "Updated Name" }),
    headers: { 'Content-Type': 'application/json' }
  },
  token
);

// DELETE request with authentication
const deleted = await sdkAuthRequest(
  BASE_URL,
  "users/123",
  { method: MethodsHttp.DELETE },
  token
);

3. File Operations (Upload/Download)

import { sdkFileRequest } from "sdk-javipopopo";

const BASE_URL = "https://api.example.com";
const token = "your-auth-token";

// Upload file with progress tracking
const uploadResult = await sdkFileRequest('upload', {
  baseURL: BASE_URL,
  path: '/upload-file',
  file: fileInput.files[0],
  token: token,
  onProgress: (progress, onCancel) => {
    console.log(`Upload progress: ${progress}%`);
    
    // Cancel upload if needed
    if (progress > 50) {
      onCancel();
    }
  }
});

// Download file with progress tracking
const downloadUrl = await sdkFileRequest('download', {
  baseURL: BASE_URL,
  path: '/download',
  url: 'https://example.com/file-to-download.pdf',
  token: token,
  onProgress: (progress, onCancel) => {
    console.log(`Download progress: ${progress}%`);
  }
});

// Use the downloaded file URL
const link = document.createElement('a');
link.href = downloadUrl;
link.download = 'downloaded-file.pdf';
link.click();

4. File Operations with Abort Signal

import { sdkFileRequest } from "sdk-javipopopo";

// Create abort controller for cancellation
const controller = new AbortController();

// Download with abort signal
const downloadPromise = sdkFileRequest('download', {
  baseURL: 'https://api.example.com',
  path: '/download',
  url: 'large-file-url',
  token: 'your-token',
  signal: controller.signal,
  onProgress: (progress, onCancel) => {
    console.log(`Download: ${progress}%`);
  }
});

// Cancel download after 5 seconds
setTimeout(() => {
  controller.abort();
}, 5000);

try {
  const result = await downloadPromise;
} catch (error) {
  if (error.name === 'AbortError') {
    console.log('Download cancelled');
  }
}

5. Query Parameter Building

import { buildQueryParams } from "sdk-javipopopo";

// Build query parameters
const params = buildQueryParams({
  page: 1,
  limit: 10,
  search: "john doe",
  active: true,
  categories: ["tech", "science"]
});

console.log(params); // "?page=1&limit=10&search=john%20doe&active=true&categories=tech&categories=science"

// Use with requests
const users = await sdkRequest(
  BASE_URL,
  `users${params}`,
  { method: MethodsHttp.GET }
);

6. Available HTTP Methods

import { MethodsHttp } from "sdk-javipopopo";

// Available methods
MethodsHttp.GET     // GET request
MethodsHttp.POST    // POST request
MethodsHttp.PUT     // PUT request
MethodsHttp.DELETE  // DELETE request
MethodsHttp.PATCH   // PATCH request

API Reference

sdkRequest<T>(baseURL, requestURL, options?): Promise<T>

Makes a basic HTTP request without authentication.

Parameters:

  • baseURL (string): Base URL for the API
  • requestURL (string): Endpoint path
  • options (RequestInit, optional): Fetch options

Returns: Promise resolving to the response data

sdkAuthRequest<T>(baseURL, requestURL, options?, token?, errorHandler?): Promise<T>

Makes an authenticated HTTP request.

Parameters:

  • baseURL (string): Base URL for the API
  • requestURL (string): Endpoint path
  • options (RequestInit, optional): Fetch options
  • token (string, optional): Authentication token
  • errorHandler (function, optional): Error handling function

Returns: Promise resolving to the response data

sdkFileRequest<T>(operation, config): Promise<T>

Handles file upload/download operations with progress tracking.

Parameters:

  • operation ('upload' | 'download'): Type of operation
  • config (object): Configuration object with operation-specific parameters

Upload Configuration:

  • baseURL (string): Base URL for the API
  • path (string): Upload endpoint path
  • file (File): File to upload
  • token (string, optional): Authentication token
  • onProgress (function, optional): Progress callback
  • signal (AbortSignal, optional): Abort signal

Download Configuration:

  • baseURL (string): Base URL for the API
  • path (string): Download endpoint path
  • url (string): URL of file to download
  • token (string, optional): Authentication token
  • onProgress (function, optional): Progress callback
  • signal (AbortSignal, optional): Abort signal

Returns:

  • Upload: Promise resolving to server response
  • Download: Promise resolving to blob URL

buildQueryParams(params): string

Builds query parameter string from object.

Parameters:

  • params (object): Object with key-value pairs

Returns: Query string with leading '?'

Error Handling

The SDK provides comprehensive error handling:

try {
  const response = await sdkAuthRequest(BASE_URL, "users", { method: MethodsHttp.GET }, token);
} catch (error) {
  if (error.type === 'API_ERROR') {
    console.error('API Error:', error.message);
  } else {
    console.error('Network Error:', error);
  }
}

TypeScript Support

The SDK is fully typed with TypeScript. All functions provide proper type inference:

import { sdkRequest, sdkAuthRequest, sdkFileRequest, MethodsHttp } from "sdk-javipopopo";

// Type is automatically inferred
const users: User[] = await sdkRequest<User[]>(BASE_URL, "users", { method: MethodsHttp.GET });

// File operations have smart type inference based on operation
const uploadResult = await sdkFileRequest('upload', {
  // TypeScript knows this needs file, baseURL, path, etc.
});

const downloadUrl = await sdkFileRequest('download', {
  // TypeScript knows this needs url, baseURL, path, etc.
});

Changelog

v2.1.0

  • Added sdkFileRequest for file upload/download operations
  • Added support for progress tracking in file operations
  • Added support for AbortSignal in file operations
  • Improved TypeScript type inference
  • Added comprehensive error handling for file operations

v2.0.2

  • Improved error handling
  • Better TypeScript support
  • Performance optimizations
  • Added support for custom headers

License

MIT © all rights to Master Javi repository