New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

size-gen

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

size-gen

A Node.js CLI utility to generate files of exact byte sizes efficiently via stream-chunked writing, perfect for testing, benchmarking, or disk space simulations.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
0
Created
Source

sizegen

NPM Version

Read this in other languages: 简体中文 | English

With streaming write technology, precisely generate files of a specified size.

Project Overview

sizegen is a command-line tool that uses streaming chunk writing to generate files of fixed sizes. It is ideal for disk testing, performance benchmarking, and generating sample data. The streaming method ensures that even large files can be generated efficiently while significantly reducing memory usage.

Key Features

  • Efficient Streaming Generation
    Generates large files efficiently using chunked writing, ensuring minimal memory usage.

  • Customizable Chunk Size
    Allows users to specify the size of the chunks used during writing based on their requirements.

Installation

Globally install sizegen using npm:

npm install -g size-gen

Alternatively, you can use other package managers for global installation:

pnpm:

pnpm add -g size-gen

yarn:

yarn global add size-gen

Note: Please ensure that Node.js is installed.

Usage

The basic command format for running sizegen is as follows:

sizegen <output> --size <size> [--chunk <chunk>]

Where:

  • <output>: The output file name (must include a file extension, e.g., data.bin).
  • --size <size>: Specifies the target file size with a unit (e.g., 10B, 512KB, 2MB, or 3.5GB).
  • --chunk <chunk>: (Optional) Specifies the chunk size used for writing, such as 16KB, 1MB, or 4MB. The default is 64KB.

Examples

  • Generate a 10MB file using the default chunk size:

    sizegen sample.bin --size 10MB
    
  • Generate a 2GB file using a 1MB chunk size:

    sizegen large.dat --size 2GB --chunk 1MB
    

Shortcuts

You can also use abbreviated options:

  • Use -s in place of --size
  • Use -c in place of --chunk

For example:

sizegen data.bin -s 10MB -c 64KB

Contributing and Feedback

We welcome contributions, bug reports, and feature suggestions! Before submitting an issue, please check the Issues page to see if similar feedback has already been provided.

License

This project is released under the MIT License.

FAQs

Package last updated on 26 Feb 2025

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