aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2018-12-06 11:49:22 +0200
committerFilipp Lepalaan <filipp@mac.com>2018-12-06 11:49:22 +0200
commit5d909855103dabb05694eae9c244aec49a9a4d34 (patch)
treea0fbb914c4a8d7ff8d30e077a2e406d0ed139a5c
parentc2f798f58095fc610f99f1bac582c6569612710a (diff)
downloadfile-metadata-master.tar.gz
file-metadata-master.tar.bz2
file-metadata-master.zip
Use absolute path to mdlsHEADmaster
To avoid clashing with shell aliases
-rw-r--r--index.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/index.js b/index.js
index 19779c0..7da5cbb 100644
--- a/index.js
+++ b/index.js
@@ -1,10 +1,12 @@
'use strict';
+
const util = require('util');
-const childProcess = require('child_process');
const plist = require('plist');
-
+const childProcess = require('child_process');
const execFileP = util.promisify(childProcess.execFile);
+const mdls = '/usr/bin/mdls';
+
const parse = data => {
const object = plist.parse(data);
const ret = {};
@@ -27,11 +29,11 @@ const parse = data => {
};
module.exports = async filePath => {
- const {stdout} = await execFileP('mdls', ['-plist', '-', filePath]);
+ const {stdout} = await execFileP(mdls, ['-plist', '-', filePath]);
return parse(stdout.trim());
};
module.exports.sync = filePath => {
- const stdout = childProcess.execFileSync('mdls', ['-plist', '-', filePath], {encoding: 'utf8'});
+ const stdout = childProcess.execFileSync(mdls, ['-plist', '-', filePath], {encoding: 'utf8'});
return parse(stdout.trim());
};