Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including exifer with all npm packages installed. Try it out:

var exifer = require("exifer")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

exifer v0.0.0

Small EXIF metadata decipher

exifer

version gzip size license dependencies

A small 1.5kb exif meta-data reader

Exifer do not analyze or parse the data. It's up to you as a consumer. I find it uncessecary in most use-cases. It's easier to build logic around numbers than magic strings.

Handy when you want to extract features from an image before upload, chekc rotation etc.

lack of Features

  • Small
  • Vanilla JS
  • Works on both server and client side
  • Zero Dependencies

Install

$ npm install exifer

This module exposes three module definitions:

  • ES Module: dist/exifer.mjs
  • UMD: dist/exifer.umd.js
  • CommonJS: dist/exifer.js

Include skaler:

// ES6
import exifer from 'exifer'

// CJS
const exifer = require('exifer');

The script can also be directly included from unpkg.com:

<script src="https://unpkg.com/exifer"></script>

Usage

import exifer from 'exifer';

/**
 * Assume 'input' is the value coming from an input field:
 * <input type="file" accept="image/*" id="input" >
 */

const input = document.getElementById('#input').files[0];

const file = await exifer(input);
// ~> resized image as a File object - half the size

const file = await exifer(input);
// ~> resized image as a File object - 300px width

const file = await exifer(input);
// ~> resized image as a File object - stretched to 300x500px

API

exifer(input, options={})

Returns: object <Promise>

Reutnrs promise that resolves to the resized File object.

Note:The new files has an updated last modified time property.

input

Type: File|Buffer|ArrayBuffer

File

Note: The file is expected to be of type image.

options.exif

Type: object

IFD: Image Tags

Find the full list of avlaible tags here

Note: The width and height options are ignored if scale is provided.

options.gps

Type: object

IFD: GPSInfo Tags

Find the full list of avlaible tags here

let file = await skaler(input, { width: 200 });
// ~> output is 200px width

Credit

License

MIT © Terkel Gjervig

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free