Socket
Socket
Sign inDemoInstall

file-flattener

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    file-flattener

File flattener


Version published
Weekly downloads
4
Maintainers
1
Install size
178 kB
Created
Weekly downloads
 

Readme

Source

File Flattener

A Node.js tool to consolidate and organize text files by extension into a single output file, with customizable inclusion and exclusion rules.

Installation

Install the package using npm:

npm install -g file-flattener

Usage

After installation, the tool can be used from the command line as follows:

flatten --extensions <file-extensions> --blacklist <blacklisted-directories>
  • --extensions, -e: A comma-separated list of file extensions to include (e.g., .js,.txt).
  • --blacklist, -b: A comma-separated list of directories to exclude (e.g., node_modules,dist). -- negExtensions, -n: A comma-separated list of file extensions to exclude (e.g., .log,.bak).

The script will output the contents of the included files to the console, each prepended with its relative file path.

Example

flatten -e ".js,.html" -b "node_modules,dist" -i ".log,.bak"

This will output to the console the contents of all .js and .html files, excluding any within node_modules or dist directories and any files with .log or .bak extensions.

Advanced Features

  • The tool performs a simple binary check to determine if a file is a text file and should be included.
  • The output includes the relative path of each file for better organization.

Keywords

FAQs

Last updated on 17 Nov 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc