Ionic And Node


#1

Im trying to use this node module [musicmetadata] in my ionic app and am facing some issues.

This is my code:

import { createReadStream } from 'fs';
import musicmetadata from 'musicmetadata';

  static getMetadata(music: string, callback?: (err: Error, res: MM.Metadata) => any) {
    musicmetadata(createReadStream(music, { autoClose: true }), (err: Error, metadata: MM.Metadata) => {
      return callback(err, metadata);
    });
  }
}

It gives me a Webpack error, I dont know if the issue is with the module of node fs module.
Please help …


#2

fs does not exist in the browser. This isn’t going to work.


#3

Thanks @rapropos would try this on a device instead


#4

Sorry, but that’s not going to work either. Not every node module is going to work outside of an actual node environment.


#5

So that means it’s impossible to use the musicmetadata module for an android app using ionic


#6

For your sake, I hope I’m wrong, but that is my inclination.