DomFileSystem.prototype.list = function(path) { if (!this.isValidPath_(path)) return Promise.reject(new AxiomError.Invalid('path', path.originalSpec)); return domfsUtil.listDirectory(this.fileSystem.root, domfsUtil.makeDomfsPath(path)).then(function(entries) { return Promise.resolve(entries); }); };
DomFileSystem.prototype.stat = function(path) { if (!this.isValidPath_(path)) return Promise.reject(new AxiomError.Invalid('path', path.originalSpec)); return domfsUtil.getFileOrDirectory(this.fileSystem.root, domfsUtil.makeDomfsPath(path)).then(function(r) { return domfsUtil.statEntry(r); }); };
return new Promise(function(resolve, reject) { var parentPath = path.getParentPath(); var targetName = path.getBaseName(); var onDirectoryFound = function(dir) { return domfsUtil.remove(dir, targetName).then(function(r) { return resolve(r); }).catch (function(e) { return reject(e); }); }; var onFileError = domfsUtil.rejectFileError.bind(null, path.relSpec, reject); this.fileSystem.root.getDirectory(domfsUtil.makeDomfsPath(parentPath), {create: false}, onDirectoryFound, onFileError); }.bind(this));
return new Promise(function(resolve, reject) { var onFileError = this.onFileError_.bind(null, reject); var onStat = function(stat) { this.entry_.file(function(f) { this.file_ = f; this.ready(); return resolve(); }.bind(this), onFileError); }.bind(this); var onFileFound = function(entry) { this.entry_ = entry; if (this.mode.write && this.mode.truncate) { this.entry_.createWriter( function(writer) { writer.truncate(0); domfsUtil.statEntry(entry).then(onStat).catch(onFileError); }, reject); return; } domfsUtil.statEntry(entry).then(function(value) { onStat(value); }).catch(function(e) { reject(e); }); }.bind(this); this.fileSystem.fileSystem.root.getFile( domfsUtil.makeDomfsPath(this.path), {create: this.mode.create, exclusive: this.mode.exclusive }, onFileFound, onFileError); }.bind(this));
return new Promise(function(resolve, reject) { domfs.root.getFile(domfsUtil.makeDomfsPath(path), {create: true}, resolve, reject); });