JSPM

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

Utility class to get information from File System. Get Directory Tree using absolute path and many more(s)

Package Exports

  • file-system-explorer

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 (file-system-explorer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

file-system-explorer

FileSystemExplorer is an utility class with which you can create JSON object from the file system, get all files/directories details from the file system, get list of files/directories, create directory, delete file/directory, rename file/directory, check free mount space from the given path and many more(s).

Installation

npm install file-system-explorer

Usage

How to import file-system-explorer?

    const fileSystemExplorer = require('file-system-explorer');

or

    import { FileSystemExplorer } from 'file-system-explorer';

After import, create an object of FileSystemExplorer class.

    // For JS
    const fsExplorer = new fileSystemExplorer.FileSystemExplorer();

or

    // For TypeScript
    const fsExplorer: FileSystemExplorer = new FileSystemExplorer();
Create JSON object from a given path (tree like structure)
    const myDownloadsTree = fsExplorer.createDirectoryTree('/home/myUser/Downloads'); // return JSON object for directory tree
Get All Directories path from a prepared Directory Tree
    const myDownloadsTree = fsExplorer.createDirectoryTree('/home/myUser/Downloads');
    const myDownloadsDirectories = fsExplorer.getAllDirectoryPathFromPreparedFSInfo(myDownloadsTree); // returns string[]
Get All Directories path from a given path (includes directories from the sub-directories)
    const myDownloadsDirectories = fsExplorer.getAllDirectoryPathFromFileSystem('/home/myUser/Downloads'); // returns string[]
Get All Files path from a prepared Directory Tree
    const myDownloadsTree = fsExplorer.createDirectoryTree('/home/myUser/Downloads');
    const myDownloadsFiles = fsExplorer.getAllFilePathFromPreparedFSInfo(myDownloadsTree); // returns string[]
Get All Files path from a given path (includes files from the sub-directories)
    const myDownloadsFiles = fsExplorer.getAllFilePathFromFileSystem('/home/myUser/Downloads'); // returns string[]
Get All Files and Directories details from a given path (include all files/directories from sub directories)
    // returns array of File/Directory details IFSInfo[]
    // Details include size, file name, type, last modified time, extension, complete path
    const myDownloadsAllFSDetails = fsExplorer.getAllFSElementsDetailsFromFileSystem('/home/myUser/Downloads');
Get All Files and Directories details from a prepared Directory Tree
    const myDownloadsTree = fsExplorer.createDirectoryTree('/home/myUser/Downloads');
    // returns array of File/Directory details IFSInfo[]
    const myDownloadsAllFSDetails = fsExplorer.getAllFSElementsDetailsFromPreparedFSInfo(myDownloadsTree);
Get All Files and Directories details from the given path
    // returns array of File/Directory details IFSInfo[]
    const myDownloadsContens = fsExplorer.getDirectoryContentList('/home/myUser/Downloads');
Create Directory in a Given path
    // creates 'New Folder' directory inside Downloads
    const mkdirResponse = createDirectory('/home/abby/Downloads/New Folder', true);
    // creates 'New Folder' directory inside Downloads, if already exists, then will create 'New Folder (1)'
    const mkdirResponse = createDirectory('/home/abby/Downloads');
    // Return mkdirResponse.errno 0 on success
Delete Directory/Files
    const deleteFSResponse = deleteDirectory('/home/abby/Downloads/New Folder (1)');
    // Returns errno 0, on sucess