Neocon Propaganda Machine

    file-tree-maker
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    file-tree-maker

    npm module

    Introduction

    Make the file tree recursively.

    Internal implemention used bfs (breadth first search).

    Usage

    In Node environment.

    npm i file-tree-maker

    const makeTree = require('file-tree-maker')
    
    makeTree(options) // => pass the `configuration`, and return the `result`, see next.

    Configuration

    entry - string

    Path of the file or the directory, absolute path is recommended.

    e.g. - absolute/path/my/dir

    exclude - Array<RegExp>

    The fullpath of the object matched one of the supplied regular expressions will be skipped.

    And do no effect to entry option.

    e.g. - [/node_modules/, /\.ingore/]

    Result Structure

    {
        type: 'file | dir' // => file or directory
        name: 'my_dir_name', // => file or directory name
        fullpath: 'absolute/path/my/dir', // => fullpath
        children: [], // => exists if type is `dir`, children's structure is same as parent's.
    }

    Tests

    yarn test

    Keywords

    Install

    npm i file-tree-maker

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4.78 kB

    Total Files

    5

    Last publish

    Collaborators

    • jinghua000