The following methods in SftpClient currently overwrite an existing file, but do not truncate it first:
- public StreamWriter CreateText(string path)
- public StreamWriter CreateText(string path, Encoding encoding)
- public void WriteAllBytes(string path, byte[] bytes)
- public void WriteAllLines(string path, IEnumerable contents)
- public void WriteAllLines(string path, string[] contents)
- public void WriteAllLines(string path, IEnumerable contents, Encoding encoding)
- public void WriteAllLines(string path, string[] contents, Encoding encoding)
- public void WriteAllText(string path, string contents)
- public void WriteAllText(string path, string contents, Encoding encoding)
The API has been "inspired" by System.IO.File, but the corresponding methods on System.IO.File actually overwrite (and truncate) an existing file.