Convert Blob sources into Files.

import { defineFilePond } from 'filepond';
import { locale } from 'filepond/locales/en-gb.js';
import { BlobLoader } from 'filepond/extensions/blob-loader.js';

defineFilePond({
    locale,
    extensions: [
        // Add the BlobLoader extension
        [BlobLoader, {
            // add any mime types that can't be derived automatically by FilePond
            mimeTypeMap: { 'application/ld+json': 'jsonld' }
        }]
    ]
})

Configuration

The BlobLoader extension accepts an option object of type BlobLoaderOptions which defines the properties below.

getBasename

Hook that runs when determining the basename for a file. Defaults to () => 'Untitled'

getBasename?: (entry: FilePondEntry, blob: Blob) => string

getExtension

Hook that runs when determining the extension of a file. The default behavior derives the extension from the file mime type. Override this function or use mimeTypeMap if an extesion isn’t computed correctly.

getExtension?: (entry: FilePondEntry, blob: Blob) => string

getFilename

Hook that runs when determining the name of a file. By default combines the result of getBasename() and getExtension()

getFilename?: (entry: FilePondEntry, blob: Blob) => string

mimeTypeMap

An object with key value pairs describing mime type relation to extension. Defaults to undefined, example { 'application/ld+json': 'jsonld' }

mimeTypeMap?: { [key: string]: string; }