Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
821 B

using System;
using System.IO;
using Microsoft.Extensions.FileProviders;
namespace Volo.Abp.VirtualFileSystem;
public class InMemoryFileInfo : IFileInfo
{
public bool Exists => true;
public long Length => _fileContent.Length;
public string? PhysicalPath => null;
public string Name { get; }
public DateTimeOffset LastModified { get; }
public bool IsDirectory => false;
private readonly byte[] _fileContent;
public string DynamicPath { get; }
public InMemoryFileInfo(string dynamicPath, byte[] fileContent, string name)
{
DynamicPath = dynamicPath;
Name = name;
_fileContent = fileContent;
LastModified = DateTimeOffset.Now;
}
public Stream CreateReadStream()
{
return new MemoryStream(_fileContent, false);
}
}