diff options
author | Filipp Lepalaan <filipp@mac.com> | 2018-12-06 11:49:22 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2018-12-06 11:49:22 +0200 |
commit | 5d909855103dabb05694eae9c244aec49a9a4d34 (patch) | |
tree | a0fbb914c4a8d7ff8d30e077a2e406d0ed139a5c | |
parent | c2f798f58095fc610f99f1bac582c6569612710a (diff) | |
download | file-metadata-master.tar.gz file-metadata-master.tar.bz2 file-metadata-master.zip |
To avoid clashing with shell aliases
-rw-r--r-- | index.js | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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()); }; |