kura
Version:
The FileSystem API abstraction library.
46 lines • 1.61 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractLocalFileSystem = void 0;
const FileError_1 = require("./FileError");
const FileSystemConstants_1 = require("./FileSystemConstants");
const FileSystemUtil_1 = require("./FileSystemUtil");
if (window.TEMPORARY == null) {
window.TEMPORARY = 0;
}
if (window.PERSISTENT == null) {
window.PERSISTENT = 1;
}
class AbstractLocalFileSystem {
constructor(options = {}) {
this.options = options;
if (options.event == null)
options.event = {};
if (options.verbose == null)
options.verbose = false;
this.PERSISTENT = window.PERSISTENT;
this.TEMPORARY = window.TEMPORARY;
}
requestFileSystem(type, size, successCallback, errorCallback) {
this.createAccessor()
.then((accessor) => {
if (accessor.options.index) {
accessor
.doMakeDirectory(FileSystemConstants_1.INDEX_DIR_PATH)
.catch(() => {
})
.finally(() => successCallback(accessor.filesystem));
}
else {
successCallback(accessor.filesystem);
}
})
.catch((err) => {
(0, FileSystemUtil_1.onError)(err, errorCallback);
});
}
resolveLocalFileSystemURL(url, successCallback, errorCallback) {
errorCallback(new FileError_1.NotImplementedError("", url));
}
}
exports.AbstractLocalFileSystem = AbstractLocalFileSystem;
//# sourceMappingURL=AbstractLocalFileSystem.js.map