5.4. User.LoadFile: Load a previously stored file

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

Given a filename in the personal namespace of the caller, this function downloads and returns the content of the corresponding file.

Note that, in the case of sharing files, the corresponding file may or may not be owned by the caller.

Returns an error if:

  • the given filename does not exist in the personal file namespace of the caller; or

  • the integrity of the downloaded content cannot be verified (indicating there have been unauthorized modifications to the file); or

  • loading the file cannot complete due to any other malicious action.

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

  • content ([]byte) – The content of the file

Return type

[]byte, error

Warning

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

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