aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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());
};