有没有办法直接比较两个缓冲区?例如有两个完全相同的文件file1和file1-copy,我想这样做:
f1 = open(file1)
f2 = open(file1-copy)
if f1 == f2
println("Equal content")
end
Run Code Online (Sandbox Code Playgroud)
我知道我可以制作相应的字符串并进行比较:
if readstring(f1) == readstring(f2)
println("Equal content")
end
Run Code Online (Sandbox Code Playgroud)
最简单的方法可能就是对mmap他们:
julia> f1 = open("file")
f2 = open("file-copy");
julia> Mmap.mmap(f1) == Mmap.mmap(f2)
true
Run Code Online (Sandbox Code Playgroud)