12

Does any one know of a way that I can read file metadata using node.js? For example, I want to read the 'comment' attribute on the 'details' tab of a jpeg file (on a Windows machine). See image below to understand what it is I am trying to read from the file's metadata.

enter image description here

Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167
bbeny
  • 632
  • 1
  • 7
  • 18
  • Well, for this particular file you're seeing EXIF image metadata. There is no generic file metadata, other than what is provided by the OS. What are you trying to do exactly? Just read EXIF for JPEG/TIFF, or something else? – Brad Sep 29 '14 at 02:56
  • I specifically need the 'Comments' field as shown in the image. I don't know if that is provided by EXIF image metadata. I guess this doesn't really need to be related to image files. The 'Comments' field can be an attribute of other file types as well. It just happens that I need to read it from a bunch of image files. – bbeny Sep 29 '14 at 15:06
  • 1
    The comments field can be in other file types' metadata but not all. For images, this data is stored via EXIF. There is no generic metadata. – Brad Sep 29 '14 at 15:08
  • What would be the best way for me to extract this info from EXIF? – bbeny Sep 29 '14 at 15:49

1 Answers1

23

There are a lot of NPM packages for reading EXIF data. For example:

https://www.npmjs.org/package/exif-parser

var parser = require('exif-parser').create(buffer);
var result = parser.parse();
console.log(result);
Brad
  • 159,648
  • 54
  • 349
  • 530