Use APP_UPLOAD_LOCATION constant for diskInfo (#271)

This commit is contained in:
bo0tzz 2022-06-27 16:14:32 +02:00 committed by GitHub
parent 40a8115101
commit 2e85e18020
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,11 +1,12 @@
import { Injectable } from '@nestjs/common';
import { ServerInfoDto } from './dto/server-info.dto';
import diskusage from 'diskusage';
import { APP_UPLOAD_LOCATION } from '../../constants/upload_location.constant';
@Injectable()
export class ServerInfoService {
async getServerInfo() {
const diskInfo = await diskusage.check('./upload');
const diskInfo = await diskusage.check(APP_UPLOAD_LOCATION);
const usagePercentage = (((diskInfo.total - diskInfo.free) / diskInfo.total) * 100).toFixed(2);