5.3. User.StoreFile: Store a new file

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.

Returns an error if:

  • the write cannot occur due to malicious action.

Parameters
  • filename (string) – The name of the file

  • content ([]byte) – File contents of the file

Warning

Do not forget that your design must satisfy all requirements, including:

  1. Different users can store files using the same filename because each user must have a separate personal file namespace (see Files).

  2. Overwriting the contents of a file does not change who the file is shared with (see Files #8).

  3. Users can have multiple active user sessions at once (see User Sessions).