The invention provides an attachment packing and unpacking method,
system and device based on a compression
algorithm and a medium, and belongs to the technical field of file compression. The method comprises the steps that all attachment files needing to be packaged are obtained by traversing a specified
directory, screening and filtering are conducted according to file attributes, and a renamed file
list and a path mapping table are generated; according to the renamed file
list, using a Brotli
algorithm to compress each attachment file based on a preset compression level, and packaging the compressed data into a packaged file containing
metadata, compressed data and
verification information; when the packed file needs to be unpacked, the legality of the packed file is confirmed through magic number
verification and index analysis, file data are recovered through Brotli streaming decompression, and the original
directory structure of the file is restored. According to the method, efficient compression and streaming decompression are achieved through the Brotli
algorithm, and the attachment
storage efficiency, the transmission speed and the
data integrity are remarkably improved in combination with the intelligent screening and
directory structure reduction technology.