You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.
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?
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!
The text was updated successfully, but these errors were encountered:
As you can see, this is basically a modified clone of dat-storage. I've outlined the differences in the file's docstring.
It looks like I'm basically needing to duplicate a bunch of core dat functionality in order to implement this, which is not ideal. I would have suggest that the createStorage part of dat-storage simply needs to be extracted into its own module, but I also needed to modify the way raf is called here to let me be able to specify a different directory.
It looks like this is because I am breaking dat's assumption that all files contained in an archive will exist at a single root. In the case of dcp that doesn't make sense.
So, two suggestions:
Modify dat-storage to handle paths that are not under a single root
Modularize createStorage so that it's easier to write your own custom storage.
Unless, of course, none of what I said made sense and I'm going about this in the wrong way, in which case please let me know!
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-1Is 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 runimportFiles
. 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. Removingtemp: 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!
The text was updated successfully, but these errors were encountered: