【发布时间】:2016-08-10 13:07:13
【问题描述】:
我在使用适用于 Git 的 TFS Rest API 检索树时遇到问题。
相关代码是
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept", 'application/zip')
$DownloadTreeCmd = "http://tfs.mycompany.com:8080/tfs/myCollection/_apis/git/repositories/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/trees/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?api-version=1.0&filename=TempDownload.zip&recursive=1"
$nresp = Invoke-RestMethod $DownloadTreeCmd -UseDefaultCredentials -Headers $headers
我最终在 $nrest 中发现了一些我无法阅读的内容。我尝试将其写入文件,但它不被识别为 zip 文件。我可以看到 I 中的数据似乎是二进制数据。
我应该如何处理这些数据。
【问题讨论】: