CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
File.js49 linesDownload Raw Back to esm
1var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {2    if (kind === "m") throw new TypeError("Private method is not writable");3    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");4    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");5    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;6};7var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {8    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");9    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");10    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);11};12var _File_name, _File_lastModified;13import { Blob } from "./Blob.js";14export class File extends Blob {15    constructor(fileBits, name, options = {}) {16        super(fileBits, options);17        _File_name.set(this, void 0);18        _File_lastModified.set(this, 0);19        if (arguments.length < 2) {20            throw new TypeError("Failed to construct 'File': 2 arguments required, "21                + `but only ${arguments.length} present.`);22        }23        __classPrivateFieldSet(this, _File_name, String(name), "f");24        const lastModified = options.lastModified === undefined25            ? Date.now()26            : Number(options.lastModified);27        if (!Number.isNaN(lastModified)) {28            __classPrivateFieldSet(this, _File_lastModified, lastModified, "f");29        }30    }31    static [(_File_name = new WeakMap(), _File_lastModified = new WeakMap(), Symbol.hasInstance)](value) {32        return value instanceof Blob33            && value[Symbol.toStringTag] === "File"34            && typeof value.name === "string";35    }36    get name() {37        return __classPrivateFieldGet(this, _File_name, "f");38    }39    get lastModified() {40        return __classPrivateFieldGet(this, _File_lastModified, "f");41    }42    get webkitRelativePath() {43        return "";44    }45    get [Symbol.toStringTag]() {46        return "File";47    }48}49 
basant307/AI_Governance_Project · CoolFace