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 🙏

© 2024 – Pkg Stats / Ryan Hefner

exifs-2-json

v1.0.0

Published

Get Exif data from JPG files from the folder and all sub-folders. Asynchronously. Export data to file or/and to a variable.

Downloads

1

Readme

exifs-2-json

Get Exif data from JPG files from the folder and its sub-folders. Asynchronously. Export data to file or/and to a variable.

Usage

npm install exifs-2-json
import exifs2json from 'exifs-2-json';

// export to variable
const exifs = await exifs2json('/path/to/my/pictures');
console.log(exifs);

// export to file
const options = { output: '../output.json' }
await exifs2json('/path/to/my/pictures', options);

Returned data can be saved to a file or assigned to the variable, or both - to file and variable at the same time.

Use options to specify the output file name and path.

Options

name | type | default | description ---|---|--- |--- output | string | undefined | A file name with path. Without a value, the file will not be created. noBuffers | boolean | true | With true all Buffer objects will be removed from Exif data. Read more about Buffers.

Results

The module returns an object with the following structure:

{
  "data": [
    {
      "file": "path/image-1.jpg",
      "err": null,
      "exif": {...}
    },
    {
      "file": "path/image-2.jpg",
      "err": null,
      "exif": {...}
    },
    {
      "file": "path/no-image.jpg",
      "err": "The given image is not a JPEG and thus unsupported right now.",
      "exif": null
    }
  ]
}

A single Exif object can look like below, but the properties and contents of the metadata might vary widely depending on the data saved in the file. You can expect dictionaries that look similar to this:

{
  "exif": {
    "image": {
      "Make": "NIKON CORPORATION",
      "Model": "NIKON D5200",
      "Orientation": 1,
      "XResolution": 300,
      "YResolution": 300,
      "ResolutionUnit": 2,
      "Software": "Ver.1.00 ",
      "ModifyDate": "2020:09:04 09:07:09",
      "YCbCrPositioning": 2,
      "ExifOffset": 222,
      "GPSInfo": 15152
    },
    "thumbnail": {
      "Compression": 6,
      "XResolution": 300,
      "YResolution": 300,
      "ResolutionUnit": 2,
      "ThumbnailOffset": 15404,
      "ThumbnailLength": 8439,
      "YCbCrPositioning": 2
    },
    "exif": {
      "ExposureTime": 0.003125,
      "FNumber": 2.8,
      "ExposureProgram": 3,
      "ISO": 250,
      "SensitivityType": 2,
      "DateTimeOriginal": "2020:09:04 09:07:09",
      "CreateDate": "2020:09:04 09:07:09",
      "CompressedBitsPerPixel": 4,
      "ExposureCompensation": 0,
      "MaxApertureValue": 3,
      "MeteringMode": 5,
      "LightSource": 0,
      "Flash": 0,
      "FocalLength": 26,
      "SubSecTime": "30",
      "SubSecTimeOriginal": "30",
      "SubSecTimeDigitized": "30",
      "ColorSpace": 1,
      "ExifImageWidth": 6000,
      "ExifImageHeight": 4000,
      "InteropOffset": 15122,
      "SensingMethod": 2,
      "CustomRendered": 0,
      "ExposureMode": 0,
      "WhiteBalance": 0,
      "DigitalZoomRatio": 1,
      "FocalLengthIn35mmFormat": 26,
      "SceneCaptureType": 0,
      "GainControl": 0,
      "Contrast": 0,
      "Saturation": 0,
      "Sharpness": 0,
      "SubjectDistanceRange": 0
    },
    "gps": {
      "GPSVersionID": [2, 3, 0, 0],
      "GPSLatitudeRef": "N",
      "GPSLatitude": [46, 12, 21.096],
      "GPSLongitudeRef": "E",
      "GPSLongitude": [10, 51, 59.72039942938659],
      "GPSAltitudeRef": 0,
      "GPSAltitude": 1619.5112359550562
    },
    "interoperability": {
      "InteropIndex": "R98"
    },
    "makernote": {
      "error": "Unable to extract Makernote information as it is in an unsupported or unrecognized format."
    }
  }
}

License

MIT