0

I have an Electron app that gets the path to audio files on the user's machine. I'm trying to use music-metadata NPM package to get metadata from a audio file (mp3), specifically the track number metadata. I installed the package and my code below is based on the examples published on the package's website:

const mm = require('music-metadata');
const util = require('util');
console.log('path.sep = ', path.sep);
mm.parseFile("C:\\Users\\marti\\Documents\\martinradio\\uploads\\VA-IF1987L\\Gastunk - The Birth Of Stars.mp3")
  .then( metadata => {
     console.log('metadata')
     console.log(util.inspect(metadata, { showHidden: false, depth: null }));
  })
  .catch( err => {
     console.log('err')
     console.error(err.message);
  });
console.log('ending get metadata')

However, the call to mm.parseFile neither succeeds nor fails, it is just being skipped over, as can be seen in this screenshot:

no metadata logged to Chrome's console

Just a little further down I get some error messages stating 'DevTools failed to load SourceMap: Could not load content for ...', as can be seen in this screenshot:

Chrome's SourceMap loading errors

Alexander Leithner
  • 3,169
  • 22
  • 33
Martin
  • 1,336
  • 4
  • 32
  • 69
  • Since this is a promise, your `console.log ("metadata");` may appear *well after* your function returns and thus also *after* `console.log ("ending get metadata");` -- let it run for a little while and see what happens. Also, better not use backslashes as path separators inside strings, Node.js will handle `/` just fine on Windows. – Alexander Leithner Sep 19 '20 at 07:36
  • Also, [this question](https://stackoverflow.com/questions/61339968/devtools-failed-to-load-sourcemap-could-not-load-content-for-chrome-extension) indicates that the warning about the source maps is not really a problem. However, it may hint at the actual problem: Chromium tries to load the source maps of the NPM package from the same directory as your code -- where it obviously does not exist. Can you confirm that the package is correctly installed inside your `node_modules` folder? – Alexander Leithner Sep 19 '20 at 07:40

0 Answers0