UNPKG

filepond

Version:

FilePond, where files go to stretch their bits.

40 lines (39 loc) • 963 B
/*! * FilePond v5.0.2 * Copyright (c) 2017-2026 Pqina B.V. * Released under the MIT License * https://filepond.com */ import { isFileEntry as n, isFile as a } from "../utils/test.js"; import { createExtension as l } from "./common/createExtension.js"; const v = l({ name: "ObjectURLResource", type: "resource", props: {}, factory: (U, { on: r, getEntryExtensionState: o, setEntryExtensionState: u }) => { function i(e) { if (!n(e) || !a(e.file)) return; const { value: t } = o(e); t && URL.revokeObjectURL(t), u(e, { value: URL.createObjectURL(e.file) }); } function s(e) { const { entry: t } = e; if (!n(t) || !a(t.file)) return; const { value: c } = o(t); c && URL.revokeObjectURL(c); } const f = r("updateEntryData", i), R = r("removeEntry", s); return { destroy: () => { f(), R(); } }; } }); export { v as ObjectURLResource };