23 lines
597 B
C#
23 lines
597 B
C#
namespace MeowStash.Services;
|
|
|
|
public class FileIOService
|
|
{
|
|
public async Task WriteFullFile(string location, byte[] data)
|
|
{
|
|
await File.WriteAllBytesAsync(location, data);
|
|
}
|
|
|
|
public async Task WriteFullFile(string location, Stream data)
|
|
{
|
|
using var stream = File.OpenWrite(location);
|
|
await data.CopyToAsync(stream);
|
|
stream.Close();
|
|
}
|
|
|
|
public async Task WritePartialFile(int id, Stream data)
|
|
{
|
|
using var stream = File.Open($"/tmp/{id}", FileMode.Append);
|
|
await data.CopyToAsync(stream);
|
|
stream.Close();
|
|
}
|
|
}
|