<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ruman Ahmed</title>
    <description>The latest articles on DEV Community by Ruman Ahmed (@ruman_ahmed).</description>
    <link>https://dev.to/ruman_ahmed</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3117456%2Fbc380120-ddf3-47c1-be55-5a057bd67ba7.jpg</url>
      <title>DEV Community: Ruman Ahmed</title>
      <link>https://dev.to/ruman_ahmed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ruman_ahmed"/>
    <language>en</language>
    <item>
      <title>Scaffold WordPress Plugins Instantly Using wp-plugin-init (Node.js CLI)</title>
      <dc:creator>Ruman Ahmed</dc:creator>
      <pubDate>Sun, 04 May 2025 07:20:14 +0000</pubDate>
      <link>https://dev.to/ruman_ahmed/scaffold-wordpress-plugins-instantly-using-wp-plugin-init-nodejs-cli-28o7</link>
      <guid>https://dev.to/ruman_ahmed/scaffold-wordpress-plugins-instantly-using-wp-plugin-init-nodejs-cli-28o7</guid>
      <description>&lt;h1&gt;
  
  
  Build WordPress Plugins Faster with &lt;code&gt;wp-plugin-init&lt;/code&gt; Boilerplate
&lt;/h1&gt;

&lt;p&gt;Creating a WordPress plugin from scratch can be time-consuming, especially when using modern tooling like &lt;strong&gt;Composer&lt;/strong&gt;, &lt;strong&gt;Vite&lt;/strong&gt;, &lt;strong&gt;Vue.js&lt;/strong&gt;, and a robust &lt;strong&gt;OOP-based MVC structure&lt;/strong&gt;. That’s where &lt;code&gt;wp-plugin-init&lt;/code&gt; comes in — a complete plugin scaffolding tool published on &lt;a href="https://www.npmjs.com/package/wp-plugin-init" rel="noopener noreferrer"&gt;npm&lt;/a&gt;, built to speed up your development and follow best practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is &lt;code&gt;wp-plugin-init&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;wp-plugin-init&lt;/code&gt; is a Node.js CLI tool that generates a fully structured WordPress plugin boilerplate in seconds. It’s tailored for modern plugin development using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP OOP and PSR-4 Autoloading via Composer&lt;/li&gt;
&lt;li&gt;MVC architecture&lt;/li&gt;
&lt;li&gt;Vue.js (for interactive admin UI)&lt;/li&gt;
&lt;li&gt;Vite (as a modern asset bundler and hot module reloader)&lt;/li&gt;
&lt;li&gt;Ready-to-extend admin dashboard&lt;/li&gt;
&lt;li&gt;Automated namespace and file structure generation&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ WordPress-ready file structure&lt;/li&gt;
&lt;li&gt;✅ MVC directory separation (&lt;code&gt;Controllers&lt;/code&gt;, &lt;code&gt;Models&lt;/code&gt;, &lt;code&gt;Views&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;✅ PSR-4 compliant autoloading&lt;/li&gt;
&lt;li&gt;✅ Vite-powered development for assets&lt;/li&gt;
&lt;li&gt;✅ Vue.js ready for dynamic admin UI&lt;/li&gt;
&lt;li&gt;✅ CLI automation for renaming namespaces, constants, menus, and plugin slugs&lt;/li&gt;
&lt;li&gt;✅ Composer autoload update after setup&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;To use &lt;code&gt;wp-plugin-init&lt;/code&gt;, install it globally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; wp-plugin-init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;Simply run the command with your desired plugin name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp-plugin-init suite-one
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new directory named &lt;code&gt;suite-one&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Rename all placeholders (&lt;code&gt;PluginsNameSpaces&lt;/code&gt;, constants, dashboard menu names)&lt;/li&gt;
&lt;li&gt;Set correct namespaces (&lt;code&gt;SuiteOne\\&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Replace plugin headers in the main file (&lt;code&gt;suite-one.php&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;composer dump-autoload&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You’ll end up with a plugin that looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;suite-one/
├── app/
│   ├── Controllers/
│   ├── Models/
│   ├── Views/
│   ├── App.php
│   └── AdminMenuHandler.php
├── composer.json
├── package.json
├── vite.config.js
├── public/
├── resources/
│   └── js/
│       └── main.js
├── suite-one.php
└── README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's Inside?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  PHP OOP Structure
&lt;/h3&gt;

&lt;p&gt;Your plugin logic is split into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Controllers/&lt;/code&gt; – Manage logic and plugin actions&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Models/&lt;/code&gt; – Handle data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Views/&lt;/code&gt; – Separate template rendering&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Composer Autoloading
&lt;/h3&gt;

&lt;p&gt;Namespaces are set dynamically based on your plugin name. After creation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;SuiteOne\Controllers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Composer’s autoload config is automatically updated.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vue.js + Vite Integration
&lt;/h3&gt;

&lt;p&gt;Your plugin is asset-ready out of the box. Inside &lt;code&gt;resources/js/main.js&lt;/code&gt;, start building your Vue components. Vite handles bundling and live reload.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During production:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Smart Defaults &amp;amp; Automation
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;wp-plugin-init&lt;/code&gt; auto-generates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Plugin headers&lt;/li&gt;
&lt;li&gt;Namespace structure&lt;/li&gt;
&lt;li&gt;Dashboard menu entries&lt;/li&gt;
&lt;li&gt;Constant definitions&lt;/li&gt;
&lt;li&gt;Vue/Vite asset paths&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No manual edits required — just start coding!&lt;/p&gt;

&lt;h2&gt;
  
  
  Development Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;App.php&lt;/code&gt; for bootstrapping logic&lt;/li&gt;
&lt;li&gt;Place reusable components in &lt;code&gt;app/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;composer dump-autoload&lt;/code&gt; after adding new PHP classes&lt;/li&gt;
&lt;li&gt;Customize the admin dashboard from &lt;code&gt;AdminMenuHandler.php&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Use Vue.js for dynamic forms or settings pages&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp-plugin-init my-cool-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Creates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Plugin header&lt;/span&gt;
&lt;span class="cm"&gt;/*
 * Plugin Name:         My Cool Plugin
 */&lt;/span&gt;

&lt;span class="c1"&gt;// Namespace usage&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;MyCoolPlugin\Controllers\DashboardController&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node.js (v14+)&lt;/li&gt;
&lt;li&gt;Composer&lt;/li&gt;
&lt;li&gt;PHP 7.4+&lt;/li&gt;
&lt;li&gt;WordPress &amp;gt;= 5.8&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;MIT – free to use and extend!&lt;/p&gt;

&lt;h2&gt;
  
  
  Contribute
&lt;/h2&gt;

&lt;p&gt;Found a bug or want to improve the boilerplate?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/Suite-Press/wp-plugin-init" rel="noopener noreferrer"&gt;github.com/Suite-Press/wp-plugin-init&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Pull requests welcome!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;If you're tired of rebuilding boilerplates or piecing together modern workflows manually, &lt;code&gt;wp-plugin-init&lt;/code&gt; is your perfect starting point. It saves time, enforces structure, and empowers you to focus on building &lt;strong&gt;features&lt;/strong&gt;, not &lt;strong&gt;boilerplate&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Start your next plugin with power, performance, and productivity — in one command.&lt;/p&gt;
&lt;/blockquote&gt;




</description>
      <category>programming</category>
      <category>node</category>
      <category>wordpress</category>
      <category>npm</category>
    </item>
    <item>
      <title>5 Utilities to Format File Sizes in JavaScript</title>
      <dc:creator>Ruman Ahmed</dc:creator>
      <pubDate>Fri, 02 May 2025 19:37:48 +0000</pubDate>
      <link>https://dev.to/ruman_ahmed/5-utilities-to-format-file-sizes-in-javascript-1835</link>
      <guid>https://dev.to/ruman_ahmed/5-utilities-to-format-file-sizes-in-javascript-1835</guid>
      <description>&lt;h2&gt;
  
  
  5 Utilities to Format File Sizes in JavaScript
&lt;/h2&gt;

&lt;p&gt;When working with file uploads, downloads, or managing files in your app, displaying file sizes in a human-readable format is essential. Instead of showing raw bytes, it’s much more user-friendly to display something like "5 KB" or "2 MB" rather than just "5120 bytes". This makes your app more polished and easier to use.&lt;/p&gt;

&lt;p&gt;Here are &lt;strong&gt;5 utilities to help you format file sizes&lt;/strong&gt; in JavaScript. These libraries and functions will make it easy to show file sizes in a friendly way.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/file-size-pretty" rel="noopener noreferrer"&gt;file-size-pretty&lt;/a&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;file-size-pretty&lt;/code&gt; is a simple, lightweight package to format file sizes into human-readable strings. It supports all common units (KB, MB, GB, etc.) and is very easy to use.&lt;/p&gt;

&lt;h4&gt;
  
  
  Installation:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;file-size-pretty
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Usage:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;formatSize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;file-size-pretty&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;formatSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1048576&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// "1 MB"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This package is perfect for when you need something fast and easy without any frills.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/filesize" rel="noopener noreferrer"&gt;filesize&lt;/a&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;filesize&lt;/code&gt; is another excellent package for formatting file sizes. It provides options to show the size in various formats and allows you to customize the output.&lt;/p&gt;

&lt;h4&gt;
  
  
  Installation:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;filesize
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Usage:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;filesize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;filesize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;filesize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1048576&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// "1 MB"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;filesize&lt;/code&gt;, you can easily format file sizes, and you also get a nice, customizable API for more control.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/humanize-plus" rel="noopener noreferrer"&gt;humanize-plus&lt;/a&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;humanize-plus&lt;/code&gt; is a utility for turning numbers into more human-readable formats. It includes the &lt;code&gt;humanize.filesize()&lt;/code&gt; method that converts bytes into a readable format.&lt;/p&gt;

&lt;h4&gt;
  
  
  Installation:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;humanize-plus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Usage:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;humanize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;humanize-plus&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;humanize&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filesize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1048576&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// "1 MB"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This one is a great choice if you need a general-purpose humanizing utility, with a simple API for file sizes.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/pretty-bytes" rel="noopener noreferrer"&gt;pretty-bytes&lt;/a&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;pretty-bytes&lt;/code&gt; is a minimal library that converts bytes into a readable string. It’s very lightweight and focuses on doing one thing — formatting file sizes in a simple way.&lt;/p&gt;

&lt;h4&gt;
  
  
  Installation:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;pretty-bytes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Usage:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prettyBytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pretty-bytes&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;prettyBytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1048576&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// "1 MB"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you’re looking for something ultra-lightweight, &lt;code&gt;pretty-bytes&lt;/code&gt; is an excellent choice.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/filesize" rel="noopener noreferrer"&gt;filesize.js&lt;/a&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;filesize.js&lt;/code&gt; is a lightweight library for formatting file sizes. It’s known for being simple and fast, with great support for large numbers.&lt;/p&gt;

&lt;h4&gt;
  
  
  Installation:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;filesize.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Usage:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;filesize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;filesize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;filesize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1048576&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// "1 MB"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With support for binary prefixes and large files, this is a great utility for serious projects that need precise formatting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;There are plenty of options when it comes to formatting file sizes in JavaScript. Whether you need something lightweight and simple like &lt;code&gt;file-size-pretty&lt;/code&gt; or something more feature-rich like &lt;code&gt;filesize&lt;/code&gt;, there’s a tool for every use case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which one do you prefer?&lt;/strong&gt; Feel free to drop a comment below and let me know if I missed any of your favorite utilities!&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
