構文
lz4compress(data: string): stringエイリアス
crypt.lz4compresscrypt.lz4.compresslz4.compress引数
| 名前 | 型 | 説明 |
|---|---|---|
data | string | 関数によって処理されたバイト文字列またはテキストを入力します。 |
戻り値
| 名前 | 型 | 説明 |
|---|---|---|
compressed | string | 圧縮されたバイト文字列。 |
説明
LZ4 を使用して文字列を圧縮し、保存または転送する前にサイズを削減します。
1 個のパラメータで呼び出します: data。引数表では必須値と動作を調整する値を確認できます。
compressed (string) を返します。戻り値表を使って成功値、nil 結果、回復可能なエラーを分けて扱ってください。
例
文字列を圧縮し、元のサイズを使用して復元します。
local source = string.rep("Real Docs ", 100)
local compressed = lz4compress(source)
local restored = lz4decompress(compressed, #source)
print(#source, #compressed, restored == source)