B2Win Suite Documentation (Under Construction)
ContactB2Data
5.6
5.6
  • B2Win Suite Documentation
  • Scripting
    • B2Win Suite Scripting Overview
    • Scripting in B2Data
      • Custom Script Nodes
        • Custom Script
        • Source Script Node (File)
        • Source Script Node (Table)
        • Source Script Node (Object)
        • If-Else Condition
        • Switch case
        • Condition Node
      • In DataPrep
      • Properties
      • Workflow Applications
        • Workflow #1
        • Workflow #2
    • Getting Started
    • Language Basics
    • Types & Objects
      • Primitives
      • Objects
        • Instant
        • LocalDateTime
        • LocalDate
        • LocalTime
        • JsonNode
        • ObjectNode
        • File
        • SuiteTable
        • Duration
        • Period
      • Arrays & Maps
      • Row, Column, StringColumn
    • Utilities
      • Date & Time
        • InstantUtil
        • GeneralDateUtil
        • LocalDateTimeUtil
        • LocalDateUtil
        • LocalTimeUtil
        • Formatting
        • Timezones
      • Math
      • StrictMath
      • NumericUtil
      • DbUtil
      • DbExecutor
      • StateUtil
      • FileUtil
      • JsonUtil
      • HttpUtil
      • NodeInputReader
      • RandomUtil
      • HashingUtil
      • ShellUtil
      • CompressionUtil
      • Logging
    • Properties
    • Context and System
      • Context
      • System
    • Configurations
      • Workflow Configuration
    • Tutorial
    • Feedback
  • B2Data
    • Tutorials
      • Infor DataFabric to On-Premise Database Replication
      • API (DB replication, Email)
    • Workflow Settings
      • General Settings
      • Global/All Properties
      • Execution Configuration
        • General
        • Runtime
        • Compiler
        • Storage
        • Clean Up
      • Permissions
    • Nodes
      • Scheduler
    • Services Configuration
      • Microsoft Graph
Powered by GitBook
On this page

Was this helpful?

  1. Scripting
  2. Utilities

CompressionUtil

CompressionUtil provides utility methods for compressing and decompressing files in various formats such as TAR.GZ and ZIP. It offers functionalities to compress multiple files into a single archive and to decompress archives into specified directories.

Methods

compressTarGzipFile(File: inputFile, String: outputFileName): File

Compresses file into a single TAR.GZ file.

@paraminputFiles — - A file path to be compressed.

@paramoutputFileName — - The name of the output TAR.GZ file.

@returns — The File with the compressed ZIP file.

// Read a file
var filePath = "path/to/your/file.txt";
var file = FileUtil.readFile(filePath);
CompressionUtil.compressTarGzipFiles(file, "generatedTarGZFileName");

compressTarGzipFiles(File[]: inputFiles, String: outputFileName): File

Compresses multiple files into a single TAR.GZ file.

@paraminputFiles — - An array of file paths to be compressed.

@paramoutputFileName — - The name of the output TAR.GZ file.

@returns — The File with the compressed ZIP file.

// Read a file
var filePath = "path/to/your/file.txt";
var file = FileUtil.readFile(filePath);
CompressionUtil.compressTarGzipFiles([file], "generatedTarGZFileName");

compressZipFile(File: inputFile, String: outputFileName): File

Compresses file into a single ZIP file.

@paraminputFile — - A file path to be compressed.

@paramoutputFileName — - The name of the output ZIP file.

@returns — The File with the compressed ZIP file.

// Read a file
var filePath = "path/to/your/file.txt";
var file = FileUtil.readFile(filePath);
CompressionUtil.compressZipFiles(file, "generatedZipFileName");

compressZipFiles(File[]: inputFiles, String: outputFileName): File

Compresses multiple files into a single ZIP file.

@paraminputFiles — - An array of file paths to be compressed.

@paramoutputFileName — - The name of the output ZIP file.

@returns — The File with the compressed ZIP file.

// Read a file
var filePath = "path/to/your/file.txt";
var file = FileUtil.readFile(filePath);
CompressionUtil.compressZipFiles([file], "generatedZipFileName");

decompressTarGzipFile(File: inputFiles, String: outputDirName): File

Decompresses a TAR.GZ file into a specified directory.

@paraminputFile — - The path of the TAR.GZ file to be decompressed.

@paramoutputDirName — - The name of the output directory.

@returns — A File path of the output directory.

// Read a file
var filePath = "path/to/your/file.tar.gz";
var file = FileUtil.readFile(filePath);
CompressionUtil.decompressTarGzipFile(file, "uncompressedTarGZDirName");

decompressZipFile(File: inputFiles, String: outputDirName): File

Decompresses a ZIP file into a specified directory.

@paraminputFile — - The path of the ZIP file to be decompressed.

@paramoutputDirName — - The name of the output directory.

@returns — A File path of the output directory.

// Read a file
var filePath = "path/to/your/file.zip";
var file = FileUtil.readFile(filePath);
CompressionUtil.decompressZipFile(file, "uncompressedZipDirName");
PreviousShellUtilNextLogging

Was this helpful?