javascript 有没有办法使用 node.js 读取文件元数据
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26091836/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a way to read file metadata using node.js
提问by bbeny
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.
有人知道我可以使用 node.js 读取文件元数据的方法吗?例如,我想读取 jpeg 文件(在 Windows 机器上)的“详细信息”选项卡上的“评论”属性。请参阅下图以了解我试图从文件的元数据中读取的内容。
回答by Brad
There are a lot of NPM packages for reading EXIF data. For example:
有很多用于读取 EXIF 数据的 NPM 包。例如:
https://www.npmjs.org/package/exif-parser
https://www.npmjs.org/package/exif-parser
var parser = require('exif-parser').create(buffer);
var result = parser.parse();
console.log(result);