euberdeveloper/dree

Can `fileCallback` & `dirCallback` support async function ?

yodhcn opened this issue · 2 comments

This is my application scenario.

const dree = require('dree');
const { getAudioMetadata } = require('../ffmpeg');

// ...
const fileCallback = async element => {
  if (element.extension === 'mp3') {
    const audioMetadata = await getAudioMetadata(element.path);
    element.audioMetadata = audioMetadata;
  }
  delete element.path;
};
// ...

const tree = dree.scanAsync(path, options, fileCallback, dirCallback)

Hi, actually now they do not support it, but I could add it in not too much time

Solved, with the new version 2.6.0, for scanAsync, you can pass async callbacks