Create a file

Each Markdown file you create will be stored inside a new versioned structured data. In order for you to be able to retrieve your files, the app needs to add the filename of each file you create to your file index.

Contents

Create a file

Create file

The app creates a versioned structured data (type tag 501) with an ID based on your user prefix and the filename. This structured data will contain all the different versions of your file. The first version is encrypted using the cipher options handle previously obtained.

Each version includes the Markdown content and the current time (encoded as a base 64 string).

The app saves the first version of your file by sending a PUT request to the SAFE Network.

Get a data ID handle

The app obtains a data ID handle for the versioned structured data that contains the file you just created.

The app adds the filename and the data ID handle to the global variable representing your file index.

Update the file index

The app updates the structured data that contains your file index. The updated file index contains the name of the file you just created.

The app saves your file index by sending a POST request to the SAFE Network.

Fetch file index

The app refetches your file index in order to update the list of files in the UI.

Fetch file index

Last updated

Was this helpful?