-
Notifications
You must be signed in to change notification settings - Fork 62
How to keep only metadata in memory? #222
Description
I would have thought that setting temp: true would store only the metadata in-memory, however it seems to store both the metadata AND all the files in memory, which seems to be confirmed by the docs - https://github.com/datproject/dat-node#storage-1
Is there a way to store only the metadata in-memory?
If you don't mind checking out my code, here's what I'm doing - https://github.com/tom-james-watson/dat-cp/blob/master/src/lib/dat-cp.js#L21. See https://github.com/tom-james-watson/dat-cp#dcp---dat-copy for context.
Note that I am manually adding files to the archive with dat.archive.createWriteStream and I never run importFiles. Changing the value of the dir provided (e.g. Dat('literally anything', ...) does not seem to have any affect with this setup, which is a little confusing.
Everything works fine with temp: true, however all files are stored in-memory. Removing temp: true alleviates the memory problem, however this then creates the .dat metadata directories, which I want to avoid.
It seems like it should be possible to keep only the contents of the .dat folder in memory. I get the impression that this could be done by writing my own storage function, but I wouldn't know where to start!
Is there anything I'm misunderstanding? Is there any way to achieve what I want? Thanks!