1.0.0 • Published 1 year ago
file-tree-export v1.0.0
file-tree-export
A flexible and powerful tool to generate and export file structure representations from local folders. This tool supports multiple output formats and respects ignore files like .gitignore.
Table of Contents
Installation
You can install file-tree-export globally via npm:
npm install -g file-tree-exportOr run it directly from GitHub:
curl -s https://raw.githubusercontent.com/yourusername/file-tree-export/main/run-file-tree-export.sh | bash -s -- [options]Usage
CLI Usage
After installation, you can use the tool from the command line:
file-tree-export [options]API Usage
You can also use file-tree-export in your Node.js projects:
const { generateFileStructure } = require('file-tree-export');
const options = {
root: '/path/to/directory',
output: 'json',
maxFiles: 1000,
maxDepth: 10,
ignoreFile: '.gitignore'
};
const result = generateFileStructure(options);
console.log(result);Options
--root: The root directory to start from (default: current working directory)--output: Output format - 'tree', 'json', 'yaml', or 'xml' (default: 'tree')--maxFiles: Maximum number of files to process (default: 2000)--maxDepth: Maximum depth to traverse (default: 32)--ignoreFile: Name of the ignore file to use (default: '.gitignore')
Output Formats
- Tree: ASCII tree representation
- JSON: Structured JSON output
- YAML: YAML representation of the file structure
- XML: XML representation of the file structure
Examples
- Generate a tree structure for the current directory:
file-tree-export- Generate JSON output for a specific directory with a depth limit:
file-tree-export --root /path/to/directory --output json --maxDepth 5- Generate YAML output ignoring files specified in
.npmignore:
file-tree-export --output yaml --ignoreFile .npmignoreContributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
1.0.0
1 year ago