{"_id":"@ciptacode/heic2jpg","_rev":"2-b1f3707bd3dc864005e2c6a9f9e7a8c7","name":"@ciptacode/heic2jpg","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@ciptacode/heic2jpg","version":"1.0.0","keywords":["heic","heif","jpg","png","wasm","webassembly","rust","react"],"author":"","license":"MIT","_id":"@ciptacode/heic2jpg@1.0.0","maintainers":[{"name":"fahrigunadi","email":"withfahri@gmail.com"}],"dist":{"shasum":"f997b44ce8fc24f1e52dbe98f398a86c7a0f9a9e","tarball":"https://registry.npmjs.org/@ciptacode/heic2jpg/-/heic2jpg-1.0.0.tgz","fileCount":6,"integrity":"sha512-MFQlCKkPlWtHXOMUBbWGim6Ve5whNh3VE1KI2F123F1iZbJmzEX5zDoS8KONqd2zMAixpB1/A6659OhFtw2G2g==","signatures":[{"sig":"MEYCIQCCMKn46RaBws91FyTyG5gIPzsqzB/5k5E9yEawCJYzpwIhAMWM5glKjYte1Gl7NZF8MCQKUei5fgTamGmtMp6OBPmc","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":462579},"main":"pkg/heic2jpg.js","types":"pkg/heic2jpg.d.ts","module":"pkg/heic2jpg.js","gitHead":"0eb92e3424cceb6278801b4c88fc94dc5b54a3d7","scripts":{"test":"cargo test","build":"wasm-pack build --target web","build:bundler":"wasm-pack build --target bundler"},"_npmUser":{"name":"fahrigunadi","email":"withfahri@gmail.com"},"_npmVersion":"10.8.2","description":"HEIC to JPG/PNG converter using Rust and WebAssembly","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"wasm-pack":"^0.14.0"},"_npmOperationalInternal":{"tmp":"tmp/heic2jpg_1.0.0_1777702367423_0.5903670118436037","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@ciptacode/heic2jpg","version":"1.0.1","description":"HEIC to JPG/PNG converter using Rust and WebAssembly","main":"pkg/heic2jpg.js","module":"pkg/heic2jpg.js","types":"pkg/heic2jpg.d.ts","scripts":{"build":"wasm-pack build --target web","build:bundler":"wasm-pack build --target bundler","test":"cargo test"},"keywords":["heic","heif","jpg","png","wasm","webassembly","rust","react"],"author":"","license":"MIT","repository":{"type":"git","url":"git+https://github.com/ciptacode/heic2jpg.git"},"bugs":{"url":"https://github.com/ciptacode/heic2jpg/issues"},"homepage":"https://github.com/ciptacode/heic2jpg#readme","devDependencies":{"wasm-pack":"^0.14.0"},"_id":"@ciptacode/heic2jpg@1.0.1","gitHead":"698a79e18adc18a0a3acad67cd99de7c3f26aaf5","_nodeVersion":"20.19.4","_npmVersion":"10.8.2","dist":{"integrity":"sha512-9CNUXkeWC/NbBnbRuE+ofBrJVPNWIrTWP/5jAGI5ol0SdRVWQz+gCI1jk3XLhm5kazX1vLDPBVhGGg6tVshwEQ==","shasum":"68cac4a57d33841e0238fd2e64241bf23e06718b","tarball":"https://registry.npmjs.org/@ciptacode/heic2jpg/-/heic2jpg-1.0.1.tgz","fileCount":6,"unpackedSize":464183,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICinJB1n82rc1a1MvOoNr/rzZWrt09mDq2/a+SR9+OfmAiAGU3wQCqf3S/Sf7PSXjxIAQIq/wR1mQtlmvvGMo6qgzg=="}]},"_npmUser":{"name":"fahrigunadi","email":"withfahri@gmail.com"},"directories":{},"maintainers":[{"name":"fahrigunadi","email":"withfahri@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/heic2jpg_1.0.1_1778081330036_0.03374974099245276"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-02T06:12:47.356Z","modified":"2026-05-06T15:28:50.301Z","1.0.0":"2026-05-02T06:12:47.577Z","1.0.1":"2026-05-06T15:28:50.188Z"},"license":"MIT","keywords":["heic","heif","jpg","png","wasm","webassembly","rust","react"],"description":"HEIC to JPG/PNG converter using Rust and WebAssembly","maintainers":[{"name":"fahrigunadi","email":"withfahri@gmail.com"}],"readme":"# @ciptacode/heic2jpg\n\nHEIC to JPG/PNG converter using Rust and WebAssembly.\n\n## Installation\n\n```bash\nnpm install @ciptacode/heic2jpg\n```\n\n## Usage in React (Vite)\n\nIf you are using Vite, you can use the `web` target build.\n\n### 1. Build the package\n\n```bash\nnpm run build\n```\n\n### 2. Use in your React component\n\n```tsx\nimport React, { useState } from 'react';\nimport init, { convert_heic_to_jpg } from '@ciptacode/heic2jpg';\n\nfunction App() {\n  const [resultImage, setResultImage] = useState<string | null>(null);\n\n  const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {\n    const file = e.target.files?.[0];\n    if (!file) return;\n\n    // Initialize the wasm module\n    await init();\n\n    const reader = new FileReader();\n    reader.onload = async (event) => {\n      const arrayBuffer = event.target?.result as ArrayBuffer;\n      const uint8Array = new Uint8Array(arrayBuffer);\n\n      try {\n        // Convert HEIC to JPG (quality 80)\n        const jpgData = convert_heic_to_jpg(uint8Array, 80);\n        \n        // Create a blob and URL for the result\n        // Note: Casting to 'any' or 'BlobPart' might be needed if your TS version \n        // complains about Uint8Array vs BlobPart compatibility.\n        const blob = new Blob([jpgData as any], { type: 'image/jpeg' });\n        const url = URL.createObjectURL(blob);\n        setResultImage(url);\n      } catch (err) {\n        console.error(\"Conversion failed\", err);\n      }\n    };\n    reader.readAsArrayBuffer(file);\n  };\n\n  return (\n    <div>\n      <h1>HEIC to JPG Converter</h1>\n      <input type=\"file\" accept=\".heic\" onChange={handleFileChange} />\n      {resultImage && (\n        <div>\n          <h2>Result:</h2>\n          <img src={resultImage} alt=\"Converted\" style={{ maxWidth: '100%' }} />\n          <br />\n          <a href={resultImage} download=\"converted.jpg\">Download JPG</a>\n        </div>\n      )}\n    </div>\n  );\n}\n\nexport default App;\n```\n\n## Usage in Vanilla JS\n\nYou can also use it directly in the browser using ES Modules.\n\n```html\n<!DOCTYPE html>\n<html lang=\"en\">\n<body>\n  <input type=\"file\" id=\"upload\" accept=\".heic\">\n  <div id=\"result\"></div>\n\n  <script type=\"module\">\n    // Import from the built package\n    import init, { convert_heic_to_jpg } from './pkg/heic2jpg.js';\n\n    async function run() {\n      // Initialize the wasm module\n      await init();\n\n      document.getElementById('upload').addEventListener('change', async (e) => {\n        const file = e.target.files[0];\n        if (!file) return;\n\n        const arrayBuffer = await file.arrayBuffer();\n        const uint8Array = new Uint8Array(arrayBuffer);\n\n        try {\n          // Convert HEIC to JPG (quality 80)\n          const jpgData = convert_heic_to_jpg(uint8Array, 80);\n          \n          const blob = new Blob([jpgData], { type: 'image/jpeg' });\n          const url = URL.createObjectURL(blob);\n\n          const resultDiv = document.getElementById('result');\n          resultDiv.innerHTML = `\n            <h2>Result:</h2>\n            <img src=\"${url}\" style=\"max-width: 100%\">\n            <br>\n            <a href=\"${url}\" download=\"converted.jpg\">Download JPG</a>\n          `;\n        } catch (err) {\n          console.error(\"Conversion failed\", err);\n        }\n      });\n    }\n\n    run();\n  </script>\n</body>\n</html>\n```\n\n## API\n\n### `convert_heic_to_jpg(data: Uint8Array, quality: number): Uint8Array`\n\nConverts HEIC data to JPEG.\n- `data`: Uint8Array of the HEIC file.\n- `quality`: JPEG quality (1-100).\n- Returns: Uint8Array of the JPEG file.\n\n### `convert_heic_to_png(data: Uint8Array): Uint8Array`\n\nConverts HEIC data to PNG.\n- `data`: Uint8Array of the HEIC file.\n- Returns: Uint8Array of the PNG file.\n\n## Development\n\n### Build for Web\n\n```bash\nnpm run build\n```\n\n### Build for Bundlers (Webpack, etc.)\n\n```bash\nnpm run build:bundler\n```\n","readmeFilename":"README.md","homepage":"https://github.com/ciptacode/heic2jpg#readme","repository":{"type":"git","url":"git+https://github.com/ciptacode/heic2jpg.git"},"bugs":{"url":"https://github.com/ciptacode/heic2jpg/issues"}}