Skip to content

compressFile

compressFile(src, dest?, options?): Promise<PathLike>

Defined in: packages/node/src/fs/compress-file.ts:61

Compress a file using the specified compression algorithm.

The destination file path can be omitted, in which case it will be generated by appending the appropriate file extension to the source file path.

By default, the source file will be deleted after compression. This can be changed by setting the keepSource option to true.

Supported compression algorithms are Brotli, Gzip, and Zstd.

PathLike

The path to the source file.

PathLike | null

The path to the destination file. If omitted, it will be generated by appending the appropriate file extension to the source file path.

CompressFileOptions

Compression options.

Promise<PathLike>

The path to the compressed file.