Log lar temizlendi
This commit is contained in:
@@ -10,20 +10,17 @@ const execAsync = promisify(exec);
|
||||
* @returns {Promise<Object>} Disk alanı bilgileri
|
||||
*/
|
||||
export async function getDiskSpace(path = '/') {
|
||||
console.log("🔍 Getting disk space for path:", path);
|
||||
try {
|
||||
// Linux/macOS için df komutu kullan
|
||||
if (process.platform !== 'win32') {
|
||||
const escapedPath = path.replace(/(["\\$`])/g, '\\$1');
|
||||
const blockFlag = process.platform === 'darwin' ? '-k' : '-k';
|
||||
const { stdout } = await execAsync(`df ${blockFlag} "${escapedPath}"`);
|
||||
console.log("📊 df command output:", stdout);
|
||||
const lines = stdout.trim().split('\n');
|
||||
|
||||
if (lines.length >= 2) {
|
||||
// Çoğu dağıtımda veriler ikinci satırda
|
||||
const data = lines[lines.length - 1].trim().split(/\s+/);
|
||||
console.log("📋 Parsed df data:", data);
|
||||
if (data.length < 5) {
|
||||
throw new Error("df output could not be parsed");
|
||||
}
|
||||
@@ -37,8 +34,7 @@ export async function getDiskSpace(path = '/') {
|
||||
const total = totalBlocks * 1024;
|
||||
const used = usedBlocks * 1024;
|
||||
const available = availableBlocks * 1024;
|
||||
|
||||
console.log("📏 Calculated sizes (bytes):", { total, used, available, usedPercent });
|
||||
|
||||
|
||||
const totalFormatted = formatBytes(total);
|
||||
const usedFormatted = formatBytes(used);
|
||||
@@ -62,7 +58,6 @@ export async function getDiskSpace(path = '/') {
|
||||
usedUnit: usedFormatted.unit
|
||||
};
|
||||
|
||||
console.log("✅ Final disk space result:", result);
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
@@ -158,7 +153,6 @@ function parseSize(sizeStr) {
|
||||
const unit = match[2] ? match[2].toUpperCase() : '';
|
||||
|
||||
const result = value * (units[unit] || 1);
|
||||
console.log(`🔍 parseSize: ${sizeStr} -> ${result} bytes`);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -228,13 +222,9 @@ export async function getDownloadsSize(downloadsPath) {
|
||||
* @returns {Promise<Object>} Kapsamlı disk bilgileri
|
||||
*/
|
||||
export async function getSystemDiskInfo(downloadsPath) {
|
||||
console.log("🔍 Getting system disk info for:", downloadsPath);
|
||||
const diskSpace = await getDiskSpace(downloadsPath);
|
||||
const downloadsSize = await getDownloadsSize(downloadsPath);
|
||||
|
||||
console.log("📊 Disk space result:", diskSpace);
|
||||
console.log("📁 Downloads size result:", downloadsSize);
|
||||
|
||||
return {
|
||||
...diskSpace,
|
||||
downloads: downloadsSize,
|
||||
|
||||
Reference in New Issue
Block a user