Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const mm = require("music-metadata");
- const fs = require("fs");
- const path = require("path");
- class meta {
- constructor(files) {
- if(!files) throw Error("files not specified");
- this.data = {};
- this.ls = files;
- }
- buildMeta() {
- var that = this;
- return new Promise(function(resolve, reject) {
- for(let i = 0; i < that.ls.length; i++) {
- mm.parseFile(that.ls[i]).then(x => {
- var info = x.common;
- that.data[info.artist] = "test";
- }).catch((x) => {
- reject(x);
- });
- }
- resolve(that.data);
- });
- }
- }
- module.exports = meta;
Add Comment
Please, Sign In to add comment