UNPKG

zipster

Version:

TypeScript library built for Node backends to create ZIP files with password protection

37 lines 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const nodePath = require("path"); const guarder_1 = require("guarder"); const ZipsterError_1 = require("../errors/ZipsterError"); /** * File Parts encapsulates the important components of a file and it's path */ class FileParts { constructor(path) { const [fileName, fileExtension] = nodePath.basename(path) .split('.'); this.path = path; this.fileName = guarder_1.Guarder.empty(fileName, 'Path missing file name', ZipsterError_1.ZipsterError); this.fileExtension = guarder_1.Guarder.empty(fileExtension, 'Path missing file extension', ZipsterError_1.ZipsterError); } /** * Get the name of the file */ getName() { return this.fileName; } /** * Get the extension of the file */ getExtension() { return this.fileExtension; } /** * Get the path of the file */ getPath() { return this.path; } } exports.FileParts = FileParts; //# sourceMappingURL=FileParts.js.map