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

@ciptacode/heic2jpg

v1.0.1

Published

HEIC to JPG/PNG converter using Rust and WebAssembly

Readme

@ciptacode/heic2jpg

HEIC to JPG/PNG converter using Rust and WebAssembly.

Installation

npm install @ciptacode/heic2jpg

Usage in React (Vite)

If you are using Vite, you can use the web target build.

1. Build the package

npm run build

2. Use in your React component

import React, { useState } from 'react';
import init, { convert_heic_to_jpg } from '@ciptacode/heic2jpg';

function App() {
  const [resultImage, setResultImage] = useState<string | null>(null);

  const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
    const file = e.target.files?.[0];
    if (!file) return;

    // Initialize the wasm module
    await init();

    const reader = new FileReader();
    reader.onload = async (event) => {
      const arrayBuffer = event.target?.result as ArrayBuffer;
      const uint8Array = new Uint8Array(arrayBuffer);

      try {
        // Convert HEIC to JPG (quality 80)
        const jpgData = convert_heic_to_jpg(uint8Array, 80);
        
        // Create a blob and URL for the result
        // Note: Casting to 'any' or 'BlobPart' might be needed if your TS version 
        // complains about Uint8Array vs BlobPart compatibility.
        const blob = new Blob([jpgData as any], { type: 'image/jpeg' });
        const url = URL.createObjectURL(blob);
        setResultImage(url);
      } catch (err) {
        console.error("Conversion failed", err);
      }
    };
    reader.readAsArrayBuffer(file);
  };

  return (
    <div>
      <h1>HEIC to JPG Converter</h1>
      <input type="file" accept=".heic" onChange={handleFileChange} />
      {resultImage && (
        <div>
          <h2>Result:</h2>
          <img src={resultImage} alt="Converted" style={{ maxWidth: '100%' }} />
          <br />
          <a href={resultImage} download="converted.jpg">Download JPG</a>
        </div>
      )}
    </div>
  );
}

export default App;

Usage in Vanilla JS

You can also use it directly in the browser using ES Modules.

<!DOCTYPE html>
<html lang="en">
<body>
  <input type="file" id="upload" accept=".heic">
  <div id="result"></div>

  <script type="module">
    // Import from the built package
    import init, { convert_heic_to_jpg } from './pkg/heic2jpg.js';

    async function run() {
      // Initialize the wasm module
      await init();

      document.getElementById('upload').addEventListener('change', async (e) => {
        const file = e.target.files[0];
        if (!file) return;

        const arrayBuffer = await file.arrayBuffer();
        const uint8Array = new Uint8Array(arrayBuffer);

        try {
          // Convert HEIC to JPG (quality 80)
          const jpgData = convert_heic_to_jpg(uint8Array, 80);
          
          const blob = new Blob([jpgData], { type: 'image/jpeg' });
          const url = URL.createObjectURL(blob);

          const resultDiv = document.getElementById('result');
          resultDiv.innerHTML = `
            <h2>Result:</h2>
            <img src="${url}" style="max-width: 100%">
            <br>
            <a href="${url}" download="converted.jpg">Download JPG</a>
          `;
        } catch (err) {
          console.error("Conversion failed", err);
        }
      });
    }

    run();
  </script>
</body>
</html>

API

convert_heic_to_jpg(data: Uint8Array, quality: number): Uint8Array

Converts HEIC data to JPEG.

  • data: Uint8Array of the HEIC file.
  • quality: JPEG quality (1-100).
  • Returns: Uint8Array of the JPEG file.

convert_heic_to_png(data: Uint8Array): Uint8Array

Converts HEIC data to PNG.

  • data: Uint8Array of the HEIC file.
  • Returns: Uint8Array of the PNG file.

Development

Build for Web

npm run build

Build for Bundlers (Webpack, etc.)

npm run build:bundler