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 🙏

© 2025 – Pkg Stats / Ryan Hefner

e-zhost-js

v1.1.1

Published

Unofficial API wrapper for E-Z.host

Readme

e-zhost-js

Unofficial API wrapper for the E-Z.host API

Installation

npm install e-zhost-js

# or

yarn add e-zhost-js

# or

pnpm add e-zhost-js

Usage

Using the SDK Class

The EZHostSDK class provides a convenient wrapper around all API methods:

import { EZHostSDK } from 'e-zhost-js';

const client = new EZHostSDK('YOUR_API_KEY');

URL Shortener

const result = await client.shortenUrl('https://example.com');
console.log('Shortened URL:', result.shortendUrl);
console.log('Deletion URL:', result.deletionUrl);

With options:

const result = await client.shortenUrl('https://example.com', {
  maxUrlLength: 2048,
  timeout: 5000,
});

Create Paste

const result = await client.createPaste('console.log("Hello World!")', {
  title: 'Example Code',
  description: 'A simple hello world example',
  language: 'javascript',
});
console.log('Paste URL:', result.pasteUrl);
console.log('Raw URL:', result.rawUrl);

File Upload

import { createReadStream } from 'fs';

const fileStream = createReadStream('./image.jpg');
const result = await client.uploadFile(fileStream, 'image.jpg');

if (result.success) {
  console.log('Image URL:', result.imageUrl);
  console.log('Raw URL:', result.rawUrl);
  console.log('Deletion URL:', result.deletionUrl);
} else {
  console.error('Upload failed:', result.message);
}

You can also upload from a Buffer:

const buffer = await fs.promises.readFile('./image.png');
const result = await client.uploadFile(buffer, 'image.png');

Deleting Resources

You can delete files, pastes, and shortened URLs using either the full deletion URL or just the deletion key:

Delete a File

const result = await client.deleteFile(uploadResult.deletionUrl);
console.log(result.message);

Delete a Paste

const result = await client.deletePaste(pasteResult.deletionUrl);
console.log(result.message);

Delete a Shortened URL

const result = await client.deleteShortener(shortenerResult.deletionUrl);
console.log(result.message);

Standalone Functions

If you prefer not to use the SDK class, you can use the standalone functions directly:

import {
  shortenUrl,
  createPaste,
  uploadFile,
  deleteFile,
  deletePaste,
  deleteShortener,
} from 'e-zhost-js';
import axios from 'axios';

const api = axios.create({
  baseURL: 'https://api.e-z.host',
  headers: { key: 'YOUR_API_KEY' },
});

const result = await shortenUrl(api, 'https://example.com');

await deleteShortener(api, result.deletionUrl);

Types

All types are exported for TypeScript users:

import type {
  ShortenUrlOptions,
  UploadFileOptions,
  CreatePasteOptions,
  DeleteOptions,
  ShortenerResponse,
  FileUploadResponse,
  PasteResponse,
  DeleteResponse,
  ShortenerDocument,
  PasteDocument,
  UploaderInfo,
  ShortenerRequest,
  CreatePasteRequest,
} from 'e-zhost-js';

API Reference

EZHostSDK Methods

| Method | Description | | --------------------------------------------- | ----------------------- | | shortenUrl(url, options?) | Shorten a URL | | createPaste(text, options?) | Create a text paste | | uploadFile(file, filename?, options?) | Upload a file | | deleteFile(deletionUrlOrKey, options?) | Delete an uploaded file | | deletePaste(deletionUrlOrKey, options?) | Delete a paste | | deleteShortener(deletionUrlOrKey, options?) | Delete a shortened URL |

Response Types

ShortenerResponse

  • success: boolean
  • shortendUrl: string - The shortened URL
  • deletionUrl: string - URL to delete the shortened link
  • document?: ShortenerDocument - Additional metadata

PasteResponse

  • success: boolean
  • pasteUrl: string - URL to view the paste
  • rawUrl?: string - URL to view raw paste content
  • deletionUrl: string - URL to delete the paste
  • document?: PasteDocument - Additional metadata including uploader info

FileUploadResponse

  • success: boolean
  • imageUrl?: string - Public URL for viewing the file
  • rawUrl?: string - Direct CDN URL
  • deletionUrl?: string - URL to delete the file

DeleteResponse

  • success: boolean
  • message: string - Success or error message

License

MIT