This version of the documentation is outdated!
Click here for the latest released version.
檔案系統
此物件表示一個檔案系統。
屬性
名稱: 檔案系統的名稱。() DOMString
根: 檔案系統的根目錄。() DirectoryEntry
詳細資訊
FileSystem
物件表示檔案系統的資訊。 檔案系統的名稱的公開的檔案系統的清單中是唯一的。 根屬性包含 DirectoryEntry
物件,表示檔案系統的根目錄。
支援的平臺
- Android 系統
- 黑莓手機 WebWorks (OS 5.0 和更高)
- iOS
- Windows Phone 7 和 8
- Windows 8
檔案系統快速示例
function onSuccess(fileSystem) {
console.log(fileSystem.name);
console.log(fileSystem.root.name);
}
// request the persistent file system
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, null);
完整的示例
<!DOCTYPE html>
<html>
<head>
<title>File System Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
}
function onFileSystemSuccess(fileSystem) {
console.log(fileSystem.name);
console.log(fileSystem.root.name);
}
function fail(evt) {
console.log(evt.target.error.code);
}
</script>
</head>
<body>
<h1>Example</h1>
<p>File System</p>
</body>
</html>