Created
July 2, 2017 20:34
-
-
Save PoslinskiNet/8d515a55ca3f1af11b479f6911e96438 to your computer and use it in GitHub Desktop.
Ember Electron Read directory service - it fetches list of directories for the given path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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