ファイルシステム内のディレクトリを表します。これは、ディレクトリ内のファイルへのアクセスと操作、およびディレクトリ内のエントリへのアクセスを可能にするメソッドを提供します。
getDirectory() を呼び出すことにより、新しいディレクトリを作成できます。サブ ディレクトリを作成する場合は、各 子ディレクトリを順番に作成します。まだ存在しない親ディレクトリを含むフル パスを使用してディレクトリを作成しようとすると、エラーが返されます。したがって、親ディレクトリを作成した後、新しいパスを再帰的に追加して階層を作成します。
このインターフェイスには独自のプロパティはありませんが、親インターフェイスである FileSystemEntry からプロパティを継承します。
このインターフェースは、その親インターフェースである FileSystemEntry からメソッドを継承します。
// Taking care of the browser-specific prefixes.
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
window.directoryEntry = window.directoryEntry || window.webkitDirectoryEntry;
...
function onFs(fs){
fs.root.getDirectory('Documents', {create:true}, function(directoryEntry){
//directoryEntry.isFile === false
//directoryEntry.isDirectory === true
//directoryEntry.name === 'Documents'
//directoryEntry.fullPath === '/Documents'
}, onError);
}
// Opening a file system with temporary storage
window.requestFileSystem(TEMPORARY, 1024*1024 /*1MB*/, onFs, onError);
| 表示内容: |
| 表示内容: |