3.0.0 • Published 3 years ago

@saschazar/wasm-exif v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

npm

📦 WebAssembly EXIF reader

A dependency-free EXIF reader written in WebAssembly

It just needs valid JPEG/TIFF data in a Uint8Array to output EXIF information, if any is included in the source file.

Installation

yarn add @saschazar/wasm-exif

or

npm install --save @saschazar/wasm-exif

Usage

It supports usage in the browser, in a Web Worker and of course Node.js.

// Node.js
import wasm_exif from '@saschazar/wasm-exif';

// Web Worker - see: https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts
importScripts('wasm_exif.js');

// -------- Browser/Web Worker/Node.js code below --------

// Load an image into a buffer using the Fetch API
const buffer = fetch('some JPEG with EXIF data').then((res) => res.buffer());

// Initialize the WebAssembly Module
const exifModule = wasm_exif({
  onRuntimeInitialized() {
    // Let the Fetch Promise fulfill
    buffer()
      .then((result) => new Uint8Array(result)) // Convert to a Uint8Array
      .then((array) => exifModule.exif(array, array.length)) // Read EXIF
      .then(console.log); // Print result to console.log
  },
});

Credits

This package uses mayanklahiri/easyexif's source code and lots of the emscripten setup code was copied from tuananh/easyexif.

License

Licensed under the MIT license.

Copyright ©️ 2020—2021 Sascha Zarhuber

3.0.0

3 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.5

4 years ago

0.1.1

4 years ago

0.0.2

4 years ago

0.1.3

4 years ago

0.0.1

4 years ago