Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/read-exif
Get Exif data from a JPEG file without reading whole contents
https://github.com/shinnn/read-exif
exif javascript jpeg jpg metadata nodejs promise
Last synced: 27 days ago
JSON representation
Get Exif data from a JPEG file without reading whole contents
- Host: GitHub
- URL: https://github.com/shinnn/read-exif
- Owner: shinnn
- License: isc
- Created: 2019-03-22T23:24:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-03-22T23:33:02.000Z (over 5 years ago)
- Last Synced: 2024-04-24T18:23:52.240Z (7 months ago)
- Topics: exif, javascript, jpeg, jpg, metadata, nodejs, promise
- Language: JavaScript
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# read-exif
[![npm version](https://img.shields.io/npm/v/read-exif.svg)](https://www.npmjs.com/package/read-exif)
[![Build Status](https://travis-ci.com/shinnn/read-exif.svg?branch=master)](https://travis-ci.com/shinnn/read-exif)
[![codecov](https://codecov.io/gh/shinnn/read-exif/branch/master/graph/badge.svg)](https://codecov.io/gh/shinnn/read-exif)A [Node.js](https://nodejs.org/) module to get Exif data from a JPEG file
```javascript
const readExif = require('read-exif');(async () => {
const exif = (await readExif('example.jpg')).Exif;// 34855: ID of the `ISOSpeedRatings` tag
exif['33434']; //=> 250// 36868: ID of the `DateTimeDigitized` tag
exif['36867']; //=> '2018:06:03 08:49:11'
})();
```Designed to be memory and CPU efficient, as this module doesn't read entire file contents but read only a necessary part of a file.
## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).
```
npm install read-exif
```## API
```javascript
const readExif = require('read-exif');
```### readExif(*path*)
*path*: `string | Buffer | Uint8Array | URL` (path to a [JPEG](https://jpeg.org/jpeg/) file)
Return: `Object`It reads Exif data from a file using [Piexifjs](https://github.com/hMatoba/piexifjs), and returns it as an `Object`.
```javascript
getExif(new URL('file:///Users/shinnn/example.jpg')); /*=> {
'0th': { ... },
'1st': { ... },
Exif: { ... },
GPS: { ... }
Interop: { ... },
thumbnail: ' ... '
} */
```## License
[ISC License](./LICENSE) © 2019 Shinnosuke Watanabe