dat
dat copied to clipboard
Use dat.json `name` for folder name on clone
From @karissa on January 10, 2017 19:55
When doing dat clone
right now it creates a folder with the hash as a name. It'd be nice if instead, we fetch the dat.json
file and if it exists, use the name
or title
key as the folder name.
Copied from original issue: joehand/dat-next#72
To download dat.json
before knowing the directory we'd have to put the database either in a temp directory or use a memdb to download the file before making the real database.
This tradeoff did not seem worthwhile to me, especially because we already download to a folder for datasets clone via the registry, e.g. dat clone karissa/more-tweets-thing
downloads to more-tweets-things
.
@joehand you didn't think this through 6 days ago before you commented.
You can create the directory using the key and once the clone is finished, rename it to whatever is in the dat.json name or title.
Ideally, we'd implement (part) of this in dat-node. It goes along with: https://github.com/datproject/dat-node/issues/30
Be nice to read the dat.json whenever it appears in metadata and add that info to the dat object. We don't need to read/create the file on disk for now.
Save clone dir to a tmp folder until it done then rename to name
if in dat.json or key
.
- What happens on partial clones? Its still nice to be able to exit and have the folder since you can always resume it later.
From @karissa on January 19, 2017 1:12
Yeah, I think renaming stuff complicates things esp for apps that are trying to integrate with a dat folder.
I'm OK postponing this. It's not essential.
+1 on postponing. I'll be much easier with append-tree and not worth implementing twice.