Sanity Library Reference Docs
    Preparing search index...

    Interface AssetSourceUploaderBeta

    interface AssetSourceUploader {
        abort(file?: AssetSourceUploadFile): void;
        getFiles(): AssetSourceUploadFile[];
        reset(): void;
        subscribe(subscriber: (event: AssetSourceUploadEvent) => void): () => void;
        updateFile(
            fileId: string,
            data: { error?: Error; progress?: number; status?: string },
        ): void;
        upload(
            files: File[],
            options?: { onChange?: (patch: unknown) => void; schemaType?: SchemaType },
        ): AssetSourceUploadFile[];
    }
    Index

    Methods

    • Beta

      Update the status of a file. Will be emitted to subscribers.

      Parameters

      • fileId: string
      • data: { error?: Error; progress?: number; status?: string }

      Returns void

    • Beta

      Parameters

      • files: File[]
      • Optionaloptions: { onChange?: (patch: unknown) => void; schemaType?: SchemaType }
        • OptionalonChange?: (patch: unknown) => void

          The uploader may send patches directly to the field Typed 'unknown' as we don't have patch definitions in sanity/types yet.

        • OptionalschemaType?: SchemaType

          The schema type of the field the asset is being uploaded to. May be of interest to the uploader to read file and image options.

      Returns AssetSourceUploadFile[]