| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/parsmega.nuxt/node_modules/memfs/lib/fsa/ |
Upload File : |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoreFileSystemFileHandle = void 0;
const CoreFileSystemHandle_1 = require("./CoreFileSystemHandle");
const CoreFileSystemSyncAccessHandle_1 = require("./CoreFileSystemSyncAccessHandle");
const util_1 = require("./util");
const CoreFileSystemWritableFileStream_1 = require("./CoreFileSystemWritableFileStream");
class CoreFileSystemFileHandle extends CoreFileSystemHandle_1.CoreFileSystemHandle {
constructor(_core, __path, ctx = {}) {
const fullCtx = (0, util_1.ctx)(ctx);
super('file', (0, util_1.basename)(__path, fullCtx.separator), fullCtx);
this._core = _core;
this.__path = __path;
this.ctx = fullCtx;
}
/**
* Returns a {@link Promise} which resolves to a {@link File} object
* representing the state on disk of the entry represented by the handle.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/getFile
*/
async getFile() {
try {
const path = this.__path;
const link = this._core.getResolvedLinkOrThrow(path);
const node = link.getNode();
if (!node.isFile()) {
throw new Error('Not a file');
}
// Get file stats for lastModified
const lastModified = node.mtime ? node.mtime.getTime() : Date.now();
// Read file content
const buffer = node.getBuffer();
const data = new Uint8Array(buffer);
const file = new File([data], this.name, { lastModified });
return file;
}
catch (error) {
if (error instanceof DOMException)
throw error;
if (error && typeof error === 'object') {
switch (error.code) {
case "EACCES" /* ERROR_CODE.EACCES */:
throw (0, util_1.newNotAllowedError)();
}
}
throw error;
}
}
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createSyncAccessHandle
*/
get createSyncAccessHandle() {
if (!this.ctx.syncHandleAllowed)
return undefined;
return async () => new CoreFileSystemSyncAccessHandle_1.CoreFileSystemSyncAccessHandle(this._core, this.__path, this.ctx);
}
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createWritable
*/
async createWritable({ keepExistingData = false } = { keepExistingData: false }) {
(0, util_1.assertCanWrite)(this.ctx.mode);
return new CoreFileSystemWritableFileStream_1.CoreFileSystemWritableFileStream(this._core, this.__path, keepExistingData);
}
}
exports.CoreFileSystemFileHandle = CoreFileSystemFileHandle;
//# sourceMappingURL=CoreFileSystemFileHandle.js.map