mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
feat: 计算缓存文件夹大小
This commit is contained in:
parent
c3ae012d06
commit
ca4725a46e
4 changed files with 46 additions and 18 deletions
|
|
@ -9,6 +9,9 @@ import { TypedElectronStore } from './index'
|
|||
import { APIs } from '../shared/CacheAPIs'
|
||||
import { YPMTray } from './tray'
|
||||
import { Thumbar } from './windowsTaskbar'
|
||||
import fastFolderSize from 'fast-folder-size'
|
||||
import path from 'path'
|
||||
import prettyBytes from 'pretty-bytes'
|
||||
|
||||
const on = <T extends keyof IpcChannelsParams>(
|
||||
channel: T,
|
||||
|
|
@ -121,6 +124,20 @@ function initOtherIpcMain() {
|
|||
cache.set(APIs.CoverColor, { id, color })
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取音频缓存文件夹大小
|
||||
*/
|
||||
on(IpcChannels.GetAudioCacheSize, event => {
|
||||
fastFolderSize(
|
||||
path.join(app.getPath('userData'), './audio_cache'),
|
||||
(error, bytes) => {
|
||||
if (error) throw error
|
||||
|
||||
event.returnValue = prettyBytes(bytes ?? 0)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
/**
|
||||
* 导出tables到json文件,方便查看table大小(dev环境)
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue