This library is clear app cache for react native.
npm install @type-any/react-native-clear-cacheimportClearCache,{formatFileSize}from'@type-any/react-native-clear-cache';// ...// This method will return byte sizeconstcacheDirSize=awaitClearCache.getCacheDirSize();// Convert byte size to read easy// second parameter is used to truncate digits, default value is 4constformat=formatFileSize(cacheDirSize);// file size symbol exampleformatFileSize(422);// 422 BytesformatFileSize(122304);// 119.4375 KBformatFileSize(10000000);// 9.5367 MBformatFileSize(87919837478);// 81.8817 GBformatFileSize(191238495867681);// 173.9304 TBformatFileSize(929292929384748571);// 825.3779 PBformatFileSize(9292929293847485728);// 8.0603 EBformatFileSize(9292929293847485719928);// 7.8714 ZBformatFileSize(13847885919183748857185858);// 11.4547 YB// truncate digits exampleformatFileSize(122304);// 119.4375 KBformatFileSize(122304,2);// 119.44 KB// Clear cacheDir// On Android, will clear both inteinternalCacheDir and externalCacheDirawaitClearCache.clearCacheDir();See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT