This commit is contained in:
Benjamin Toby
2025-04-18 12:06:15 +01:00
parent 8d38f99bf1
commit 6593047efd
180 changed files with 3965 additions and 2 deletions
+14
View File
@@ -0,0 +1,14 @@
import imageInputFileToBase64 from "./imageInputFileToBase64";
import imageInputToBase64 from "./imageInputToBase64";
/**
* ==========================
* Main Export
* ==========================
*/
declare const datasquirelClient: {
media: {
imageInputToBase64: typeof imageInputToBase64;
imageInputFileToBase64: typeof imageInputFileToBase64;
};
};
export default datasquirelClient;
+11
View File
@@ -0,0 +1,11 @@
import { ImageInputFileToBase64FunctionReturn } from "../../package-shared/types";
type Param = {
imageInputFile: File;
maxWidth?: number;
imagePreviewNode?: HTMLImageElement;
};
/**
* # Image input File top Base64
*/
export default function imageInputFileToBase64({ imageInputFile, maxWidth, imagePreviewNode, }: Param): Promise<ImageInputFileToBase64FunctionReturn>;
export {};
+15
View File
@@ -0,0 +1,15 @@
type FunctionReturn = {
imageBase64?: string;
imageBase64Full?: string;
imageName?: string;
};
type Param = {
imageInput: HTMLInputElement;
maxWidth?: number;
mimeType?: string;
};
/**
* # Image Input Element to Base 64
*/
export default function imageInputToBase64({ imageInput, maxWidth, mimeType, }: Param): Promise<FunctionReturn>;
export {};
+21
View File
@@ -0,0 +1,21 @@
type FunctionReturn = {
fileBase64?: string;
fileBase64Full?: string;
fileName?: string;
fileSize?: number;
fileType?: string;
};
type Param = {
inputFile: File;
allowedRegex?: RegExp;
};
/**
* Input File to base64
* ==============================================================================
*
* @description This function takes in a *SINGLE* input file from a HTML file input element.
* HTML file input elements usually return an array of input objects, so be sure to select the target
* file from the array.
*/
export default function inputFileToBase64({ inputFile, allowedRegex, }: Param): Promise<FunctionReturn>;
export {};