UNPKG

@edge-store/react

Version:

Image Handling for React/Next.js

50 lines 1.52 kB
import * as React from "react"; type UploadImageHandler = (file: File, options?: { /** * The path to upload the image to. * @default - "/" */ path?: string; /** * The name of the image. * @default - auto-generated */ name?: string; /** * Whether to overwrite the image if it already exists. * @default - false */ overwrite?: boolean; /** * The progress callback. * You can use this to get the progress of the upload. */ onProgressChange?: (progress: number) => void; }) => Promise<{ url: string; }>; type GetImgSrcHandler = ( /** * The url of the image. * @example - "https://my-domain.com/images/example.png" */ url: string) => string; type EdgeStoreContextValue = { uploadImage: UploadImageHandler; uploadProtectedImage: UploadImageHandler; getImgSrc: GetImgSrcHandler; }; export declare const EdgeStoreProvider: React.FC<{ children: React.ReactNode; /** * In case your app is not hosted at the root of your domain, you can specify the base path here. * If you set this, make sure to set the full path to the EdgeStore API. * e.g. `/my-app/api/edgestore` or `https://example.com/my-app/api/edgestore` * * @example - If your app is hosted at `https://example.com/my-app`, you can set the `basePath` to `/my-app/api/edgestore`. */ basePath?: string; }>; export declare const useEdgeStore: () => EdgeStoreContextValue; export {}; //# sourceMappingURL=index.d.ts.map