docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class FileCompressor

    Since C# only has GZipStream until .NET 4.0, we are forced to implement our own packing system for artifact files. We compact all artifacts into a single GZip Stream with the header before the file name and contents. The header contains the file name length and file length (in bytes).

    Inheritance
    object
    FileCompressor
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.Build.Pipeline.Utilities
    Assembly: Unity.ScriptableBuildPipeline.Editor.dll
    Syntax
    public class FileCompressor

    Methods

    Compress(string, string)

    Compresses all artifacts located at a specified directory.

    Declaration
    public static bool Compress(string directoryPath, string archiveFilePath)
    Parameters
    Type Name Description
    string directoryPath

    The directory containing the artifacts.

    string archiveFilePath

    The file path at which the archive will be created.

    Returns
    Type Description
    bool

    Returns true if the directory was found and compressed. Returns false otherwise.

    Decompress(string, string)

    Extracts all artifacts compressed in an archive.

    Declaration
    public static bool Decompress(string archiveFilePath, string directoryPath)
    Parameters
    Type Name Description
    string archiveFilePath

    The archive to decompress.

    string directoryPath

    The path where the extracted artifacts will be stored.

    Returns
    Type Description
    bool

    Returns true if the archive was found and decompressed. Returns false otherwise.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)