
Security News
Meet the Socket Team at RSAC and BSidesSF 2025
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
check-disk-space
Advanced tools
Light multi-platform disk space checker without third party for Node.js
The check-disk-space npm package is used to check the disk space available on a specified drive in a Node.js application. It provides a simple and efficient way to retrieve disk space information, such as free space and total space, which can be crucial for applications that manage or monitor system resources.
Check Disk Space
This feature allows you to check the disk space of a specified drive. It provides information about the total space and the free space available on the drive. The function returns a promise that resolves with an object containing the disk space details.
const checkDiskSpace = require('check-disk-space').default;
checkDiskSpace('/path/to/directory').then((diskSpace) => {
console.log(diskSpace)
// Output will include:
// diskSpace.free: the available space on the disk
// diskSpace.size: the total size of the disk
});
The 'diskusage' package provides similar functionality to check-disk-space, offering methods to get the total and free disk space. It differs slightly in its API and the way it handles system calls, potentially affecting performance and compatibility with different Node.js versions.
node-disk-info is another alternative that fetches disk information. Unlike check-disk-space, it provides more detailed information about each mounted disk drive, including used space, which can be useful for more detailed system analysis and monitoring.
Light multi-platform disk space checker without third party for Node.js.
npm install check-disk-space
// ES
import checkDiskSpace from 'check-disk-space'
// CommonJS
const checkDiskSpace = require('check-disk-space').default
// On Windows
checkDiskSpace('C:/blabla/bla').then((diskSpace) => {
console.log(diskSpace)
// {
// diskPath: 'C:',
// free: 12345678,
// size: 98756432
// }
// Note: `free` and `size` are in bytes
})
// On Linux or macOS
checkDiskSpace('/mnt/mygames').then((diskSpace) => {
console.log(diskSpace)
// {
// diskPath: '/',
// free: 12345678,
// size: 98756432
// }
// Note: `free` and `size` are in bytes
})
FAQs
Light multi-platform disk space checker without third party for Node.js
The npm package check-disk-space receives a total of 1,346,826 weekly downloads. As such, check-disk-space popularity was classified as popular.
We found that check-disk-space demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Security News
Biome's v2.0 beta introduces custom plugins, domain-specific linting, and type-aware rules while laying groundwork for HTML support and embedded language features in 2025.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.