0.1.1 • Published 11 months ago

als-diskinfo v0.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

Als-diskinfo

This utility is a Node.js script to fetch information about disk space on Windows and Linux systems.

Features

Fetches disk information such as total space, used space, and free space. Works on Windows and Linux systems.

Usage

const diskInfo = require('als-diskinfo');
diskInfo().then(disks => console.log(disks)).catch(error => console.error(error));

The function getDisks() returns a Promise that resolves with an array of disk objects. Each disk object contains the following properties:

  • name: The identifier of the disk.
  • size: The total size of the disk in kilobytes.
  • used: The used space on the disk in kilobytes.
  • free: The free space on the disk in kilobytes. mountedOn: (Linux only) The mount point of the disk.

The Promise rejects with an Error if there is an issue in fetching or parsing the disk information.

Limitations

  1. Different Linux systems and df output: This utility parses the output from df -kP, which is relatively standardized across different Linux systems. However, there might be slight variations in the format or set of fields in some systems, especially older or non-standard distributions. While this is unlikely, it is always a good idea to test on the specific system.

  2. Command output encoding: The command output will generally be in the system's encoding, which is typically UTF-8 for many modern operating systems, including most Linux distributions and Windows. However, in rare cases, or if the command outputs text in a specific encoding (for instance, if it generates output in a non-English language), the output might be in a different encoding. In such cases, appropriate encoding would be needed to correctly decode the text.

For these limitations, the best approach would be to test the utility on the target systems to ensure it works as expected and to handle any exceptions that might occur during the parsing of command output.