Save a new version

When you edit an existing file, a new version is stored inside the structured data associated with that file.

Contents

Save a new version

Get a data ID handle

The app obtains a data ID handle for the versioned structured data (type tag 501) that contains the file you just edited. The ID of this structured data is based on your user prefix and the name of the file.

Get a structured data handle

The app obtains a structured data handle using the data ID handle of the file you just edited.

After obtaining a structured data handle, the app drops the data ID handle of the file you just edited.

Update the file

The app stores a new version inside the structured data associated with the file you just edited. It's encrypted using the cipher options handle previously obtained.

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

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

Fetch all versions

The app refetches all the versions of the file and displays them in the UI.

Fetch all versions

Last updated

Was this helpful?