happybeing / safenetworkjs

SAFE Network application, file system and utility library for NodeJS (web, desktop and cli)
9 stars 4 forks source link

Implement create / delete directory #3

Open happybeing opened 5 years ago

happybeing commented 5 years ago

Before we can implement create and delete of directories we should review the implementation options because the current SAFE NFS API support is not clear, nor is the best way to implement this.

For example, SAFE Drive does not implement stand alone directories using the SAFE NFS API, but instead simulates them until a file is saved, at which point any new directories on the path of the file will appear to have been created.

The alternative, mentioned here, is to create a directory by creating an entry in an NFS container which points to an empty NFS sub-container. This is not yet officially documented, and is not ideal because it can lead to a cascade of sub-containers, which may or may not be undesirable due to effects on latency, use of PUTS etc.

So before deciding on how to implement empty directories this within SafentetworkJS we might want to wait for more discussion and official documentation, and guidance on best practices. At that point we can discuss and agree on implementation.

Note: when this has been clarified, we'll need to decide whether to implement this on the NfsFileState class which provides all the low level file operations, used by NfsContainer, or on the NfsContainer class itself.