Created
July 13, 2019 13:24
-
-
Save danielgospodinow/39d1f01713701021fe3bb077a758f124 to your computer and use it in GitHub Desktop.
Screentopia - cleanup images function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cleanupImages(imageDirectory, imageDirectoryCapacity) { | |
const images = fs.readdirSync(imageDirectory); | |
if (images.length >= imageDirectoryCapacity) { | |
console.log("Cleaning up space ..."); | |
fs.unlinkSync(imageDirectory + "/" + images.pop()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment