Disk size getting bigger

Hello i used fs to save my API as json file and then load on every start. but every time i save it disk size is getting bigger and bigger because its like saving twice the file, could someone help me?

Hi @Svxxk776789k,

One thing you could do is add a check to your project so it looks at existing code before rewriting it.

Here is a guide that explains how this can be done:

Let us know if that helps you!

Another possibility is the file is being version controlled by git, which keeps another copy on each save.

To prevent this, move the file into a folder called “.data”, which git ignores. Or create a file called “.gitignore” and add folder or file names to it.

Note that ignored files won’t show up in the Glitch editor. https://glitch.com/help/hidden-files/

To reclaim the disk space, do the commands in the console

git prune
git gc

As described in https://glitch.com/help/when-i-try-to-edit-a-project-it-just-refreshes-and-doesnt-save-my-changes/

1 Like