본문으로 바로가기

mkZiplib 1.0

category 확장 패키지 (Extension Package) 2024. 10. 11. 12:08

홈페이지 : http://mkextensions.sourceforge.net/

mkZiplib은 기본적으로 압축 라이브러리인 Zlib 1.1.3과 Minizip 0.15의 래퍼입니다. 데이터를 압축 및 해제하고 .gz(gzip으로 생성된) 및 .zip 파일로 작업할 수 있는 4가지 새로운 명령을 제공합니다. mkZiplib은 Tcl의 최신 API 함수 중 일부를 사용하므로 Tcl 8.2 이상이 필요합니다.

 

mkZiplib is essentially a wrapper around the compression libraries Zlib 1.1.3 and Minizip 0.15 (see the notes section below). It provides four new commands that allow to compress and decompress data, and to work with .gz (as produced by gzip) and .zip files. mkZiplib makes use of some of Tcl's newer API functions and therefore requires Tcl 8.2 or higher.

Deflate and inflate

  % set sComp [deflate -level 9 "We all live in a yellow submarine, yellow submarine, yellow submarine..."]
  (...Repetitive patterns are good for compression...)
  % inflate $sComp
  We all live in a yellow submarine, yellow submarine, yellow submarine...

  The gz command

  % set hGz [gz open test.gz w]
  4457920
  % gz write $hGz "We all live in a yellow submarine, yellow submarine, yellow submarine...\n"
  72
  % gz close $hGz
  %
  % set hGz [gz open test.txt.gz]
  4457920
  % gz gets $hGz
  We all live in a yellow submarine, yellow submarine, yellow submarine...
  % gz close $hGz

 The zip command  

 % set hZip [zip open test.zip w]
  10289776
  % zip set $hZip file1.txt -level 9 -comment "File 1" -time [clock seconds]
  % zip write $hZip "This is the contents of file 1"
  % zip set $hZip file2.txt -level 9 -comment "File 2" -time [clock seconds]
  % zip write $hZip "This is the contents of file 2"
  % zip comment $hZip "My first zip file"
  %
  % set hZip [zip open test.zip]
  10244344
  % zip comment $hZip
  My first zip file
  % zip files $hZip
  file1.txt file2.txt
  % zip info $hZip file1.txt
  988336176 30 30 0 {File 1}
  % zip info $hZip file1.txt
  988336234 30 30 0 {File 2}
  % zip set $hZip file1.txt
  % zip read $hZip
  This is the contents of file1
  % zip set $hZip file2.txt
  % zip read $hZip
  This is the contents of file2
  % zip close $hZip

mkZiplib10.zip
0.09MB

'확장 패키지 (Extension Package)' 카테고리의 다른 글

BWidget 1.9.16  (0) 2024.10.11
mkWidgets 1.3  (0) 2024.10.11
OTcl 1.14  (0) 2024.10.11
Snit 1.0  (0) 2024.10.11
Winico 0.6  (0) 2024.10.11