我正在尝试将二进制数据输出到标准输出(使用 Kemal 提供一些动态二进制数据)。
这是一个测试:
size = File.size( "./img.png" )
slice = Slice( UInt8 ).new( size )
File.open( "./img.png" ) do |file|
file.read_fully( slice )
end
我试过没有成功:
slice
slice.hexdump
slice.hexstring
slice.to_a
slice.to_s
slice.to_unsafe.value