31 lines
879 B
JavaScript
31 lines
879 B
JavaScript
|
"use strict";
|
||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
|
};
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
const fs_1 = __importDefault(require("fs"));
|
||
|
const promisified_functions_1 = require("../../utils/promisified-functions");
|
||
|
class BaseResource {
|
||
|
constructor(path) {
|
||
|
this._error = null;
|
||
|
this._contentStream = null;
|
||
|
this._path = path;
|
||
|
}
|
||
|
async _checkAccess(path) {
|
||
|
try {
|
||
|
await (0, promisified_functions_1.access)(path, fs_1.default.constants.R_OK);
|
||
|
}
|
||
|
catch (e) {
|
||
|
this._error = e;
|
||
|
}
|
||
|
}
|
||
|
get error() {
|
||
|
return this._error;
|
||
|
}
|
||
|
get contentStream() {
|
||
|
return this._contentStream;
|
||
|
}
|
||
|
}
|
||
|
exports.default = BaseResource;module.exports = exports.default;
|
||
|
|