Skip to content

INFO: Installation for other N00bs like me (who have no idea how to make it work) #2

@PeterCodar

Description

@PeterCodar

Thanks to "copilot" I got it running with these steps:

a) create and change into a new directory in your Ubuntu (or other linux-like Distro):

mkdir exiftool-example
cd exiftool-example

b) create a new npm project:
npm init -y

c) install vite and @uswriting/exiftool:
npm install vite @uswriting/exiftool

d) create an index.html file with this content:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>ExifTool Example</title>
</head>
<body>
  <input type="file" />
  <script type="module" src="/main.js"></script>
</body>
</html>

e) create a main.js file with this content:

import { parseMetadata } from '@uswriting/exiftool';

document.querySelector('input[type="file"]').addEventListener('change', async (event) => {
  const file = event.target.files[0];
  const result = await parseMetadata(file);
  
  if (result.success) {
    console.log(result.data);
  } else {
    console.error('Error:', result.error);
  }
});

f) create a vite.config.js file with this content:

export default {
  root: '.',
}

g) start the vite development server with:
npx vite

(If you want to expose it to your network, use
npx vite --host

h) click with the pressed CTRL key on the link presented in the terminal window, something like
http://localhost:5173/
or (i fnpx vite started with --host)
http://10.255.255.254:5173/

i) Now you can choose a file in the opened standard browser.
The extracted information from exiftool can be found if you open the Inspect part of your browser (F12) and have a look at the console output.

Hope this helps other N00bs like me .-)

If anyone knows an easier way for beginners, please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions