import { TransferSpec, DataTransferResponse, ConnectStyleFile, PromiseObject, TransferStatus, UploadOptions } from '../models/models'; /** * Used to update the transfer in the activity monitor for a specific transfer. If transfer not found it is ignored * * @param id the id of the transfer to update * @param status the status of the transfer * @param total the total bytes of the transfer * @param current the amount of bytes transferred thus far * @param error error body * @param currentFile the current file being transferred */ export declare const updateTransferActivity: (id: string, status: TransferStatus, total?: number, current?: number, error?: any, currentFile?: File) => void; /** * Slice a file and read it in with FileReader. This uses the callback to send the read event. * This function supports falling back to vendor prefix versions * of the slice function for older Firefox and Webkit browsers. * * @param file the file to slice * @param filePosition the start position of the file to slice * @param chunksize the end position of the file to slice * @param callback the callback to use for FileReader * @param fileReader the FileReader to use for reading in data */ export declare const handleBlobSlicing: (file: File, filePosition: number, chunksize: number, callback: any, fileReader: FileReader) => void; /** * Software mode version of `handleBlobSlicing` for dealing with Buffer instead of File API * * @param file the file to slice (data string is a FileSystem readFile in binary format) * @param filePosition the start position of the file to slice * @param chunksize the end position of the file to slice * @param callback the callback to use for triggering event on slice * * @example * ```javascript * const fileInfo = fs.statSync(filePointer); * const file = { * data: fs.readFileSync(filePointer, {encoding: 'binary'}), * size: fileInfo.size, * type: 'file', * lastModified: fileInfo.mtime.toISOString(), * name: filePointer, * } * ``` */ export declare const handleSoftwareModeSlicing: (file: { name: string; data: string; type: string; lastModified: string; }, filePosition: number, chunksize: number, callback: any) => void; /** * Start sending chunked data through the opened websocket * * @param socket the WebSocket to use for data transfer * @param transferSpec the transferSpec to send for the upload * @param id the ID of the transfer for monitoring * @param queue the array of functions to call for sending data * @param fileReaderToUse the file reader to use for this transfer */ export declare const startSendingData: (socket: WebSocket, transferSpec: TransferSpec, files: File[], id: string, queue: (() => void)[], fileReaderToUse: FileReader) => void; /** * Add file input to a form for getting files from the local computer * * @param form form to add new file input to */ export declare const addFilePickerToForm: (form: HTMLFormElement) => HTMLElement; /** * Add file input to a form with folder support for getting folders from the local computer * * NOTE: this cannot stop files from being picked. * * @param form form to add new file input to */ export declare const addFolderPickerToForm: (form: HTMLFormElement) => HTMLElement; /** * Request file picker for choosing files * * @param id the ID of the form to use (must be unique to each transfer grouping) * @param callback the function to call once the files are added */ export declare const getFilesForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void; /** * Request file picker for choosing files and use promise. * Uses `getFilesForUpload` logic wrapped in a Promise * * @param id the ID of the form to use (must be unique to each transfer grouping) * * @returns promise that resolves with the files (error state is never used) */ export declare const getFilesForUploadPromise: (id: string) => Promise; /** * Request folder picker for choosing folders * @remarks Feature not supported. Will be introduced in future release. * * @param id the ID of the form to use (must be unique to each transfer grouping) * @param callback the function to call once the folders are added */ export declare const getFoldersForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void; /** * Request folder picker for choosing folders and use promise. * Uses `getFoldersForUpload` logic wrapped in a Promise * @remarks Feature not supported. Will be introduced in future release. * * @param id the ID of the form to use (must be unique to each transfer grouping) * * @returns promise that resolves with the folders/file list (error state is never used) */ export declare const getFoldersForUploadPromise: (id: string) => Promise; /** * Start the Websockets and transfer * * @param id the ID to use for the transfer * @param transferSpec the transferSpec of the transfer * @param files the files to transfer * @param promiseInfo the promise data to resolve for the transfer if needed */ export declare const startWebSocketTransfer: (id: string, transferSpec: TransferSpec, files: File[], promiseInfo?: PromiseObject, options?: UploadOptions) => void; /** * Start a HTTP Gateway upload. * * @param transferSpec standard Connect transferSpec for uploading * @param id the ID of the form group to use for files * @param memoryFilesToLoad array of files from memory to use. These will be used all the time and if transferSpec does not contain them an error will raise. * @param options options for customizing the upload * * @returns a promise that resolves if upload is successful and rejects if upload cannot be started */ export declare const upload: (transferSpec: TransferSpec, id: string, memoryFilesToLoad?: File[], options?: UploadOptions) => Promise; /** * Create a dropzone linked to a form grouping. * All drops are stored in same place to allow body drops. * * @param callback the function to call once the files are dropped * @param elementSelector the selector of the element on the page that should watch for drop events */ export declare const createDropzone: (callback: (data: { event: any; files: { dataTransfer: { files: ConnectStyleFile[]; }; }; }) => void, elementSelector: string) => void; /** * Remove dropzone added by gateway. * * @param elementSelector the selector of the element on the page that should remove */ export declare const removeDropzone: (elementSelector: string) => void; declare const _default: { upload: (transferSpec: TransferSpec, id: string, memoryFilesToLoad?: File[], options?: UploadOptions) => Promise; updateTransferActivity: (id: string, status: TransferStatus, total?: number, current?: number, error?: any, currentFile?: File) => void; startSendingData: (socket: WebSocket, transferSpec: TransferSpec, files: File[], id: string, queue: (() => void)[], fileReaderToUse: FileReader) => void; addFilePickerToForm: (form: HTMLFormElement) => HTMLElement; createDropzone: (callback: (data: { event: any; files: { dataTransfer: { files: ConnectStyleFile[]; }; }; }) => void, elementSelector: string) => void; removeDropzone: (elementSelector: string) => void; getFilesForUploadPromise: (id: string) => Promise; getFilesForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void; getFoldersForUploadPromise: (id: string) => Promise; getFoldersForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void; }; export default _default;