alapa
Version:
A cutting-edge web development framework designed to revolutionize the way developers build modern web applications.
36 lines (35 loc) • 1.06 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Storage = void 0;
const path_1 = __importDefault(require("path"));
const local_1 = require("./driver/local");
const globals_1 = require("../shared/globals");
class Storage {
driver;
constructor(driver) {
this.driver =
driver || globals_1.GlobalConfig?.storage?.driver || new local_1.LocalStorageDriver();
}
set setDriver(driver) {
this.driver = driver;
}
get absolutePath() {
return this.driver.absolutePath;
}
get baseURL() {
return this.driver.absoluteURL;
}
getFullPath(filePath) {
return path_1.default.join(this.absolutePath, filePath);
}
getFullURL(filePath) {
return `${this.baseURL}/${filePath}`;
}
saveFile(filePath, key) {
return this.driver.saveFile(filePath, key);
}
}
exports.Storage = Storage;