5.5. User.AppendToFile: Efficiently append data to an existing file

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

Given a filename in the personal namespace of the caller, this function appends the given content to the end of the corresponding file.

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

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

You are not required to check the integrity of the existing file before appending the new content (integrity verification is allowed, but not required).

Returns an error if:

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

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

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

  • content ([]byte) – The data to be appended to the existing file

Return type

error

Warning

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

  1. The implementation of AppendToFile() must satisfy the efficiency requirement (see Efficiency).

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