Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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 823,368 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.