Skip to main content Link Search Menu Expand Document (external link)

5.3 User.StoreFile

StoreFile(filename string, content []byte) (err error)

Given a filename in the personal namespace of the caller, this function persistently stores the given content for future retrieval using the same filename.

If the given filename already exists in the personal namespace of the caller, then the content of the corresponding file is overwritten. Note that, in the case of sharing files, the corresponding file may or may not be owned by the caller.

The client MUST allow content to be any arbitrary sequence of bytes, including the empty sequence.

Note that calling StoreFile after malicious tampering has occurred is undefined behavior, and will not be tested.

Returns an error if:

  1. The write cannot occur due to malicious action.


filename (string) - the name of the file
content ([]byte]) - the contents of the file


err (error)

Do not forget that your design must satisfy all requirements, including:
  • Different users can store files using the same filename, because each user must have a separate personal file namespace.
  • Overwriting the contents of a file does not change who the file is shared with.
  • Users can have multiple active user sessions at once.