c4se記:さっちゃんですよ☆

.。oO(さっちゃんですよヾ(〃l _ l)ノ゙☆)

.。oO(此のblogは、主に音樂考察Programming に分類されますよ。ヾ(〃l _ l)ノ゙♬♪♡)

音樂は SoundCloud に公開中です。

考察は現在は主に Scrapbox で公表中です。

Programming は GitHub で開發中です。

遲延評價Streamでgzip/gunzipするElixirのライブラリを作った

Stream で hash を計算する

stream_hash | Hex

何故無かった。

github.com

"test/fixture/xyzxyz.txt"
|> File.stream!
|> StreamHash.hash(:sha512)
|> Enum.to_list
|> hd

# <<215, 133, 241, 243, 115, 159, 59, 127, 111, 242, 140, 106, 171, 211, 130, 48,
#   174, 198, 241, 236, 195, 112, 105, 150, 106, 133, 78, 249, 2, 178, 132, 254,
#   50, 181, 85, 46, 183, 97, 187, 7, 38, 17, 26, 188, 232, 143, 152, 210, 71, 54,
#   245, 48, 107, 70, 180, 43, 96, 26, 69, 90, 17, 156, 111, 65>>

Stream で gzip/gunzip する

stream_gzip | Hex

何故無かった。

github.com

Gunzip:

"x.gz"
|> File.stream!
|> StreamGzip.gunzip
|> Enum.join

Gzip:

"x"
|> File.stream!
|> StreamGzip.gzip
|> Stream.into(File.stream! "x.gz")
|> Stream.run