FluentFTP
FluentFTP copied to clipboard
Override Read(Span), ReadAsync(Memory), Write(ROS), WriteAsync(ROM) in streams
Available in NETSTANDARD2_1 and NET5_0_OR_GREATER, the base class functions in Stream for backwards compatibility rent an array and copy the span to it and then call the old array based functions.
As an optimization FtpDataStream and FtpSocketStream can override these functions and pass the call directly onto the wrapped stream.
public override void Write(ReadOnlySpan<byte> buffer) {
if (BaseStream == null) {
return;
}
BaseStream.Write(buffer);
m_lastActivity = DateTime.UtcNow;
}
Like how the old FtpClient has been changed https://github.com/dotnet/runtime/blob/main/src/libraries/System.Net.Requests/src/System/Net/FtpDataStream.cs#L231
I would appreciate it if you could spare the time and make a PR.
I've put up a draft PR but I need to sort out a machine I can run the docker tests on
Thanks a lot, will review it.