Example #1
0
 /// <summary>
 /// Writes a zip file
 /// </summary>
 /// <param name="zipPath">string - the path to the zip file to be written.</param>
 /// <param name="internalFilename">string - the name of the file within the zip file.  It can be a path</param>
 /// <param name="data">string - the data to be written into the zip file.</param>
 /// <returns>nothing</returns>
 public static async Task ZipAsync(string zipPath, string internalFilename, string data)
 {
     byte[] buf = Encoding.ASCII.GetBytes(data);
     using (var fs = File.Create(zipPath, buf.Length))
     {
         using (var s = new ZipOutputStream(fs))
         {
             s.PutNextEntry(internalFilename);
             await s.WriteAsync(buf, 0, buf.Length);
         }
     }
 }