Beispiel #1
0
        public async Task <FileStreamResult> CompresionLZW(IFormFile archivo, string nombre)
        {
            LZW.Comprimir(archivo, nombre);

            var newFile = new FileInfo(Path.Combine(Environment.CurrentDirectory, "compress", $"{nombre}.lzw"));

            NodoArchivo.ManejarCompressions(
                new NodoArchivo
            {
                Algoritmo        = "LZW",
                NombreOriginal   = archivo.FileName,
                Nombre           = $"{nombre}.lzw",
                RutaArchivo      = Path.Combine(Environment.CurrentDirectory, "compress", $"{nombre}.lzw"),
                RazonCompresion  = (double)newFile.Length / (double)archivo.Length,
                FactorCompresion = (double)archivo.Length / (double)newFile.Length,
                Porcentaje       = 100 - (((double)newFile.Length / (double)archivo.Length) * 100)
            });

            return(await Download(Path.Combine(Environment.CurrentDirectory, "compress", $"{nombre}.lzw")));
        }
Beispiel #2
0
 public static void Compirimir(string rutatexto, ref string nombre)
 {
     lzw.Comprimir(rutatexto, ref nombre);
 }
Beispiel #3
0
 public async Task <FileStreamResult> compressProduct(string name)
 {
     LZW.Comprimir(name);
     return(await Download($"temp\\{name}.txt"));
 }