Search Results for

    Show / Hide Table of Contents

    Plugin: File compression

    Introduction

    This plugin provides methods to ease working with zip files.

    Features

    Zip an array of bytes

    Compress an array of bytes.

    Method Name: ZipBytes

    Input

    • FileBytes (required): a key-value dictionary where
      • Key: Name of the file
      • Value: A byte-array - the content to be compressed

    Output

    • Output: An object
      • IsSuccess: true or false
      • Data: a base64 string represents the compressed content
      • Error: The error message in case something goes wrong

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    
    var input = new Dictionary<string, byte[]>();
    var fileName = ctx.Get<string>("FileName");
    var bytes = ctx.Get<byte[]>("Bytes");
    input.Add(fileName, bytes);
    
    var parameters = new Dictionary<string, object>()
    {
         { "FileBytes", input }
    };
    var pluginResult = pluginApi.Invoke("CwCompression", "ZipBytes", parameters);
    var output = pluginResult.GetObject("Output");
    

    Unzip an array of bytes

    Decompress an array of bytes.

    Method Name: UnzipBytes

    Input

    • ZippedBytes (required): a compressed byte array to decompress

    Output

    • Output: An object
      • IsSuccess: true or false
      • Data: A key-value dictionary where
        • Key: Name of the file
        • Value: A byte-array - the content to be compressed
      • Error: The error message in case something goes wrong

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    
    var bytes = ctx.Get<byte[]>("Bytes");
    var parameters = new Dictionary<string, object>()
    {
         { "ZippedBytes", bytes }
    };
    var pluginResult = pluginApi.Invoke("CwCompression", "UnzipBytes", parameters);
    var output = pluginResult.GetObject("Output");
    

    Installation

    Requirements

    • Casewhere v2.6 or later

    Configuration

    The plugin requires no configuration.

    Releases

    1.0.0 - 15/05/2020

    Changelog

    • Zip an array of bytes

    Download (login required): File compression plugin v1.0.0

    In This Article
    Back to top Generated by DocFX