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

@sikandarmoyaldev/file-converter

v0.0.5

Published

A robust, type-safe, and highly performant file conversion utility for Node.js and the browser.

Readme

File Converter

A robust, type-safe, and highly performant file conversion utility built with pure TypeScript.

⚠️ Note: This package is Browser Compatible Only for now. It is designed to run 100% client-side in the browser (e.g., React, Next.js, Vanilla JS) to ensure maximum privacy with zero server uploads. Node.js support is planned for a future release.

✨ Features

  • Browser Compatible Only (For Now): Runs 100% client-side. Your files never leave the user's device.
  • React & Frontend Ready: Seamlessly integrates with React, Next.js, Vue, and vanilla frontend applications.
  • Adapter Pattern Architecture: Built with a scalable Adapter Pattern, making it incredibly easy to plug in new file format converters without touching core logic.

📂 Supported Formats (Current)

Thanks to our Adapter Pattern, the package currently supports the following conversions out of the box:

| Input Format | Output Formats Supported | | :--------------------------------------------------------------------- | :------------------------------------------ | | Images (.jpg, .jpeg, .png, .webp, .gif, .bmp, .tiff) | Any other supported Image format, or .pdf | | Apple HEIC/HEIF (.heic, .heif) | .jpg, .png, .webp | | PDF (.pdf) | .jpg, .png (First page extraction) |

(More adapters for formats like DOCX, AVIF, and multi-page PDF rendering are actively being developed!)

📦 Installation

Install the package via your preferred package manager:

# Using pnpm (recommended)
pnpm add @sikandarmoyaldev/file-converter

# Using npm
npm install @sikandarmoyaldev/file-converter

# Using yarn
yarn add @sikandarmoyaldev/file-converter

🚀 Usage

Core API (Vanilla JS/TypeScript)

import { converter } from "@sikandarmoyaldev/file-converter";

// Convert a single file
const blob = await converter.convert(file, "png", { quality: 0.9 });

// Convert multiple files
const blobs = await converter.convertMultiple(files, "jpeg", { quality: 0.8 });

// Get supported output formats for a file type
const formats = converter.getSupportedOutputFormats("image/png");

React: Single File

import { useConverter } from "@sikandarmoyaldev/file-converter/react";

function SingleFileConverter() {
    const { progress, status, convertedBlob, error, convert, reset } = useConverter();

    const handleConvert = async (file: File) => {
        await convert(file, "png", { quality: 0.9 });
    };

    return (
        <div>
            <input
                type="file"
                onChange={(e) => e.target.files?.[0] && handleConvert(e.target.files[0])}
            />

            {status === "converting" && <p>Progress: {progress}%</p>}
            {status === "completed" && convertedBlob && (
                <a href={URL.createObjectURL(convertedBlob)} download="converted.png">
                    Download
                </a>
            )}
            {status === "error" && <p>Error: {error}</p>}

            <button onClick={reset}>Reset</button>
        </div>
    );
}

React: Multiple Files

import { useConvertMultiple } from "@sikandarmoyaldev/file-converter/react";

function MultiFileConverter() {
    const {
        files,
        isConverting,
        overallProgress,
        addFiles,
        removeFile,
        updateFileFormat,
        convertAll,
        reset,
    } = useConvertMultiple();

    const handleFileSelect = (e: React.ChangeEvent<HTMLInputElement>) => {
        if (e.target.files) {
            addFiles(Array.from(e.target.files), "jpeg");
        }
    };

    return (
        <div>
            <input type="file" multiple onChange={handleFileSelect} />

            <p>Overall Progress: {overallProgress}%</p>

            {files.map((file) => (
                <div key={file.id}>
                    <span>{file.file.name}</span>
                    <span>Status: {file.status}</span>
                    <span>Progress: {file.progress}%</span>

                    <select
                        value={file.targetFormat}
                        onChange={(e) => updateFileFormat(file.id, e.target.value)}
                        disabled={isConverting}
                    >
                        <option value="jpeg">JPG</option>
                        <option value="png">PNG</option>
                        <option value="webp">WEBP</option>
                    </select>

                    <button onClick={() => removeFile(file.id)} disabled={isConverting}>
                        Remove
                    </button>

                    {file.convertedBlob && (
                        <a href={URL.createObjectURL(file.convertedBlob)} download={file.file.name}>
                            Download
                        </a>
                    )}
                </div>
            ))}

            <button onClick={() => convertAll({ quality: 0.9 })} disabled={isConverting}>
                {isConverting ? "Converting..." : "Convert All"}
            </button>

            <button onClick={reset} disabled={isConverting}>
                Clear All
            </button>
        </div>
    );
}

🤝 Contributing

Contributions are welcome! Please read the CONTRIBUTING.md file for details on our code of conduct, the tools we use, and the process for submitting pull requests.