Bundling.Extensions.Helpers.VirtualFileReader.GetBinaryFileContents C# (CSharp) Method

GetBinaryFileContents() public method

public GetBinaryFileContents ( string fileName ) : byte[]
fileName string
return byte[]
		public byte[] GetBinaryFileContents(string fileName)
		{
			fileName = this.PathResolver.GetFullPath(fileName);

			var virtualPathProvider = HostingEnvironment.VirtualPathProvider;
			var virtualFile = virtualPathProvider.GetFile(fileName);
			using (var stream = virtualFile.Open())
			{
				var buffer = new byte[stream.Length];
				stream.Read(buffer, 0, (int)stream.Length);
				return buffer;
			}
		}