UNPKG

@sentclose/sentc-nodejs

Version:

End-to-end encryption sdk

37 lines (36 loc) 1.97 kB
/// <reference types="node" /> import { User } from "../User"; import { FileMetaInformation, PartListItem } from "../Enities"; import { FileHandle } from "node:fs/promises"; export declare function findAvailableFileName(file_path: string): Promise<string>; export declare class Downloader { private base_url; private app_token; private user; private group_id?; private readonly group_as_member?; private static is_init; private static mutex; static cancel_download: boolean; static init(): void; constructor(base_url: string, app_token: string, user: User, group_id?: string, group_as_member?: string); /** * Get the file info and the first page of the file part list * * @param file_id */ downloadFileMetaInformation(file_id: string): Promise<FileMetaInformation>; /** * Download the rest of the part list via pagination * * @param file_id * @param last_item */ downloadFilePartList(file_id: string, last_item?: PartListItem | null): Promise<PartListItem[]>; downloadFileParts(fileHandle: FileHandle, part_list: PartListItem[], content_key: string): Promise<void>; downloadFileParts(fileHandle: FileHandle, part_list: PartListItem[], content_key: string, updateProgressCb: (progress: number) => void): Promise<void>; downloadFileParts(fileHandle: FileHandle, part_list: PartListItem[], content_key: string, updateProgressCb: (progress: number) => void | undefined, verify_key: string): Promise<void>; downloadFilePartsWithPath(path: string, part_list: PartListItem[], content_key: string): Promise<void>; downloadFilePartsWithPath(path: string, part_list: PartListItem[], content_key: string, updateProgressCb: (progress: number) => void): Promise<void>; downloadFilePartsWithPath(path: string, part_list: PartListItem[], content_key: string, updateProgressCb: (progress: number) => void | undefined, verify_key: string): Promise<void>; }