New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

md-file-tree-enhanced

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

md-file-tree-enhanced

生成文件目录列表到Markdown文件中

0.1.1
latest
Source
npm
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

node-file-tree-md

Generate markdown tree of all the files in a directory, recursively.Custom directory name, file name 生成文件目录列表到Markdown文件中,可以设置过滤的文件后缀名,或自定义目录名、文件名

How to use?

Install the script

Usage

options extends readdir-enhanced

Basic

import readdir from "@jsdevtools/readdir-enhanced";

// Find all .txt files
readdir("my/directory", {filter: "*.txt"});

// Find all package.json files
readdir("my/directory", {filter: "**/package.json", deep: true});

Extra Options

  • formatFileName: function
  • formatDirectoryName: function,
  • outputFilePath: string,
  • prefix: array,
  • ignore: array
const defaultOptions = {
  formatFileName,
  formatDirectoryName,
  deep: stats => ignoreNodeModules(stats, defaultOptions),
  filter: stats => myFilter(stats, defaultOptions),
  outputFilePath: 'list.md',
  prefix: ['.html'],
  ignore: ['node_modules', '.git', '.idea'],
}

Example

const {generateMdTree} = require('md-file-tree-enhanced')

generateMdTree('.', {
  outputFilePath: 'readme.md',
  prefix: ['.html', '.js'],
  ignore: ['node_modules', '.git', '.idea'],
  formatDirectoryName: (name)=>{
    return name+'1'+'\n'
  },
  formatFileName: (name, path)=>{
    return name+path+'\n'
  },
  // or
  // filter: myFilter,

}).then(({ output, files }) => {
  // console.log(res);
})

This generates the list.md file with:

 - __CSS__
    - [IEMUSTGODIE.html](CSS/IEMUSTGODIE.html)
    - [Love Heart.js](CSS/Love Heart.js)
    - [WebpackIcon.html](CSS/WebpackIcon.html)
    - [border-arrow.html](CSS/border-arrow.html)
    - __box-shadow__
        - [box-shadow.html](CSS/box-shadow/box-shadow.html)
        - [aaa.js](CSS/box-shadow/aaa.js)
    - [linear-gradient.html](CSS/linear-gradient.html)
    - [photo-3d.html](CSS/photo-3d.html)

Keywords

md

FAQs

Package last updated on 28 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts