DropBoxからファイルをダウンロードしています。デフォルトのアプリケーションでファイルを開く方法
File.exists(filePath)
を使用してファイルが存在し、それがtrue
を返すことがわかります。 しかし、File.fromPath(filePath)
またはopenUrl(filePath)
のいずれかのファイル(既定のアプリケーションで)を開くことができません。ここで
は私のコードです:Webリンクのためにのみ動作し、ローカルファイルを開くために使用することはできませんopenUrl
HomePage.prototype.getDownload = function() {
var filePath = fs.path.join(fs.knownFolders.currentApp().path, "MyFile");
httpModule.getFile({
url: "https://content.dropboxapi.com/2/files/download",
method: "POST",
headers: { "Content-Type": "", "Dropbox-API-Arg": JSON.stringify({"path": "/MyFolder/MyFile"}), "Authorization": "Bearer *********" },
}, filePath).then(function (response) {
console.log("file exists: "+fs.File.exists(filePath)); // This return true
// tried this
fs.File.fromPath(filePath); // Does nothing
// tried this
utilsutils.openUrl(filePath); // Does nothing
}