让我假设我在android中有一个文件夹,它可能在内部或外部存储中: " VIKAS KOHLI"文件夹,我想签入" VIKAS KOHLI"是否有.mp4文件。 那我怎么用cordova来检查呢?
提前致谢!
答案 0 :(得分:1)
您需要使用File插件。这里有一些基本的示例代码:
window.resolveLocalFileSystemURL(DIR_FULL_PATH, function(dirEntry) {
var directoryReader = dirEntry.createReader();
console.log(dirEntry);
// Get a list of all the entries in the directory
directoryReader.readEntries(success,fail);
});
function success(entries) {
var i;
for (i=0; i<entries.length; i++) {
//Here you can check the entries ofject for the file name and do stuff
console.log('En - ', entries[i]);
}
}
function fail(error) {
console.log("Failed to list directory contents: ", error);
}