A simple command-line tool to generate files of various types and specific sizes.
- π Create files of common types (e.g.,
.txt
,.zip
,.jpg
, etc.) - π Specify exact file size (e.g., 10KB, 5MB, 1GB, etc.)
- β‘ Fast and lightweight utility
- Node.js v22.12 (LTS)
Install globally using npm:
npm install file-plz -g
Basic usage:
npx file-plz -t txt -s 10KB
Options:
Option | Shorthan | Description | Example |
---|---|---|---|
--size |
-s |
Size of the file (KB, MB, or GB) | 10KB , 5MB |
--type |
-t |
File extension | jpg , txt |
--debug |
-d |
Output debug info | - |
-
Create a 1MB text file
npx file-plz -t txt -s 1MB
-
Create a 500KB bitmap file
npx file-plz -t txt --size 500KB --t .bmp
-
Create a 1GB archive file
npx file-plz -t zip -size 1GB
- File Generation: The program has a base set of instructions to create simple files, which are then merged with more complex file types to achieve the specific file size.
- File Content: The data within the files is random characters or generated noise.
Achieving precise file sizes can be challenging, especially when working with compression and noise. For compressed file types (like .zip
), the final size depends on the compressibility of the file's contents. Random data is less compressible than repeating patterns, which can affect the actual size. Similarly, files with "noise" data may not be perfectly predictable in size, as different file systems and tools may handle binary data differently. This tool strives to get as close as possible to the requested size, but minor deviations may occur.
- Found a bug? Open an issue here.
- Want to contribute? Fork the repo, make changes, and submit a pull request.
This project is licensed under the MIT License. See LICENSE for details.
β If you find this tool useful, please give it a star!