且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

搜索文件的备用数据流

更新时间:2022-11-03 08:01:37

.NET不直接支持备用文件流。  NuGet上有第三方库可以添加对它的支持,例如
这个。您可以使用它来枚举流,然后访问内容。或者,您可以调用Win32本机支持它们。我认为NuGet中的包装器会更干净。

.NET doesn't support the alternate file streams directly.  There are third party libraries available on NuGet that add support for it such as this. You can use that to enumerate the streams and then access the contents. Alternatively you can just call to Win32 which supports them natively. I think the wrapper in NuGet would be cleaner.

有趣的是,PowerShell通过Get-Item和stream属性开箱即用。我没有看过实现。

Interestingly PowerShell does support this out of the box via Get-Item and the stream property. I haven't looked at the implementation though.