从特定文件夹获取特定文件

嗨,我做了一个Windows 8的JavaScript应用程序,Ÿ怎么知道如何得到一个文件女巫的名字是从C:\ Users \ Me \ Pictures \ thifolder example2.dat我试过使用Windows.Storage.StorageFile.getFileFromPathAsync("C:\Users\Me\Pictures\thisfolder"); 但它没有工作,因为我有另一个文件,如example1.dat,example3.dat example.jpg等

希望我明确表示感谢

这是我的代码到目前为止

  function here() { var getJsonStringAsync = function () { return Windows.Storage.StorageFile.getFileFromPathAsync("C:\Users\Me\Pictures\thisfolder") //Also tried this //return Windows.Storage.KnownFolders.picturesLibrary.getFileAsync(u_u + "_" + u + "_" + ".dat") .then(function (file) { return Windows.Storage.FileIO.readTextAsync(file); }); }; getJsonStringAsync().then(function (text) { document.getElementById("line").innerHTML = text; }); } 

在图片库中读取文件的正确方法是:(不要忘记在应用程序的清单中声明对pict​​uresLibrary的访问)

 var getJsonStringAsync = function () { var picturesLibrary = Windows.Storage.KnownFolders.picturesLibrary; return picturesLibrary.getFolderAsync("thisfolder").then(function (folder){ return folder.getFileAsync("example2.dat").then(function (file) { return Windows.Storage.FileIO.readTextAsync(file); }); }); }; 

在JavaScript中,这里是如何播放音乐库中的“song.mp3”:

HTML:

  <audio id="player1">Your browser does not support audio </audio> 

JavaScript的:

  var ml = Windows.Storage.KnownFolders.musicLibrary; ml.getFileAsync("song.mp3").then(function (file) { // its a storage file, so create URL from it var s = window.URL.createObjectURL(file); player1.setAttribute("src", s); player1.play(); //}); });