DiskHealthIndicator

The DiskHealthIndicator contains checks which are related to the disk storage of the current running machine

  
class DiskHealthIndicator {
  checkStorage<Key extends string = string>(key: Key, options: (Without<DiskOptionsWithThreshold, DiskOptionsWithThresholdPercent> & DiskOptionsBase & DiskOptionsThresholdPercent) | (Without<...> & ... 1 more ... & DiskOptionsThreshold)): Promise<HealthIndicatorResult<Key>>
}

Methods

checkStorage()

Checks if the size of the given size has exceeded the given threshold


checkStorage<Key extends string = string>(key: Key, options: (Without<DiskOptionsWithThreshold, DiskOptionsWithThresholdPercent> & DiskOptionsBase & DiskOptionsThresholdPercent) | (Without<...> & ... 1 more ... & DiskOptionsThreshold)): Promise<HealthIndicatorResult<Key>>

Parameters

Option Type Description
key Key

The key which will be used for the result object

options (Without & DiskOptionsBase & DiskOptionsThresholdPercent) | (Without<...> & ... 1 more ... & DiskOptionsThreshold)

Examples

    
// The used disk storage should not exceed 250 GB
diskHealthIndicator.checkStorage('storage', { threshold: 250 * 1024 * 1024 * 1024, path: '/' });
    
// The used disk storage should not exceed 50% of the full disk size
diskHealthIndicator.checkStorage('storage', { thresholdPercent: 0.5, path: 'C:\\' });

Returns

Promise<HealthIndicatorResult<Key>> The result of the health indicator check

Throws

HealthCheckError In case the health indicator failed

StorageExceededError In case the disk storage has exceeded the given threshold