JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q34101F

Get list of files recursively in the specified folder with options

Package Exports

  • folder-contents

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (folder-contents) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM

folder-contents

Get list of files recursively in the specified folder with options

Usage

var fcs = require('folder-contents');

var options = {
    "path":"./test",
    "extSep":".",
    "extIgnore":[],
    "extAccept":[],
    "folderIgnore":[],
    "fileIgnore":[]
};
var jsonFileList = fcs.getFilesList(options);
console.log(jsonFileList);

defaults :

  • path : '.' (folder where we want to list files . is equal to ./ )
  • extSep : '.' (extention separator 'toto.jpg')
  • extIgnore : [] (list of extentions to ignore ['jpg',...] )
  • extAccept : [] (list of extentions to accept ['mkv',...] )
  • folderIgnore : [] (list of folder to ignore ['.svn',...] )
  • fileIgnore : [] (list of file to ignore ['toto',...] for 'toto.jpg' )

If extAccept is used, extIgnore content is ignored.

Result exemple :

[
    { path: './test/', name: '', ext: 'htaccess' },
    { path: './test/', name: 'noext', ext: '' },
    { path: './test/', name: 'toto', ext: 'jpg' },
    { path: './test/subfolder/', name: 'film.vo.team-yo', ext: 'mkv' }
]

NOTE : Package in work