﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Autofac.Extras.Common.IO
{
    public sealed class FileUtil
    {
        private FileUtil()
        {
            //
        }

        public static void write(String path, byte[] data)
        {
            using (var streamWriter = new StreamWriter(path))
            {
                streamWriter.Write(data);
            }
        }

        // * [Limit image size](https://stackoverflow.com/a/12492258)
        public static bool checkFileSize(String filename, long maxBytes) {
            var fileInfo = new FileInfo(filename);
            return fileInfo.Length > maxBytes;
        }
    }
}
