![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
An ES modules implementation based on exif-heic-js to get EXIF of an image.
import { useState } from 'react';
import * as Exifly from "exifly";
export default function () {
const [tags, setTags] = useState('');
const handleFileChange = e => {
let extension = e.target.files[0].name.toLowerCase().split('.').at(-1);
let reader = new FileReader();
reader.onload = function () {
const exifly = new Exifly.load(reader.result);
if (extension === 'heic') {
tags = exifly.heic()
} else if (extension === 'jpg' || extension === 'jpeg') {
tags = exifly.jpeg();
} else {
tags = exifly.raw();
}
console.log(tags);
setTags(JSON.stringify(tags, null, 2));
};
reader.readAsArrayBuffer(e.target.files[0]);
}
return (
<>
<div>
<input type="file" id="image" accept=".heic,.jpeg,.jpg" onChange={handleFileChange} />
</div>
<div>
<pre>{tags}</pre>
</div>
</>
)
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Exifly</title>
</head>
<body>
<div>
<input type="file" id="image" accept=".heic,.jpeg,.jpg" />
</div>
<div>
<pre id="tags"></pre>
</div>
<script src="../dist/exifly.umd.js"></script>
<script>
document.getElementById("image").onchange = function (e) {
let extension = e.target.files[0].name.toLowerCase().split('.').at(-1);
let reader = new FileReader();
reader.onload = function () {
const exifly = new Exifly.load(reader.result);
if (extension === 'heic') {
tags = exifly.heic()
} else if (extension === 'jpg' || extension === 'jpeg') {
tags = exifly.jpeg();
} else {
tags = exifly.raw();
}
console.log(tags)
document.getElementById('tags').textContent = JSON.stringify(tags, null, 2);
};
reader.readAsArrayBuffer(e.target.files[0]);
}
</script>
</body>
</html>
FAQs
An ES modules Typescript implementation to get EXIF of an image
The npm package exifly receives a total of 0 weekly downloads. As such, exifly popularity was classified as not popular.
We found that exifly demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.