You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
445 B

  1. define([
  2. 'fs',
  3. 'path'
  4. ], function(
  5. fs,
  6. fsPath
  7. ) {
  8. return {
  9. getFolder: function(path) {
  10. return fs.readdirSync(path).filter(function(file) {
  11. return !fs.statSync(fsPath.join(path, file)).isDirectory();
  12. });
  13. },
  14. getFolderList: function(path) {
  15. try {
  16. return fs.readdirSync(path).filter(function(file) {
  17. return fs.statSync(fsPath.join(path, file)).isDirectory();
  18. });
  19. } catch (e) {
  20. return [];
  21. }
  22. }
  23. };
  24. });