Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ember Electron Read directory service - it fetches list of directories for the given path
import Ember from 'ember';
const fs = requireNode('fs')
const path = requireNode('path')
export default Ember.Service.extend({
/**
* Get list of the directories for the given path
* @param {String} absolutePath absolute path
* @return {Array} List of directories in the given path
*/
getDirectories(absolutePath) {
return fs.readdirSync(absolutePath)
.filter(file => fs.lstatSync(path.join(absolutePath, file)).isDirectory());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.