5.3. User.StoreFile: Store user files

Implement this method:

StoreFile(filename string, data []byte) (err error)
  • Stores the file persistently for future retrieval.

  • If a user calls StoreFile() on a filename that already exists, the content of the existing file is overwritten.

Parameters
  • filename (string) – File name

  • data ([]byte) – File contents

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 file namespace (see Files #6).

  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).