UNPKG

qiniu-js

Version:

Javascript SDK for Qiniu Resource (Cloud) Storage AP

56 lines (55 loc) 2.2 kB
import { Progress, LocalInfo } from '../upload'; import Logger from '../logger'; export declare const MB: number; export declare function getChunks(file: File, blockSize: number): Blob[]; export declare function isMetaDataValid(params: { [key: string]: string; }): boolean; export declare function isCustomVarsValid(params: { [key: string]: string; }): boolean; export declare function sum(list: number[]): number; export declare function setLocalFileInfo(localKey: string, info: LocalInfo, logger: Logger): void; export declare function createLocalKey(name: string, key: string | null | undefined, size: number): string; export declare function removeLocalFileInfo(localKey: string, logger: Logger): void; export declare function getLocalFileInfo(localKey: string, logger: Logger): LocalInfo | null; export declare function getAuthHeaders(token: string): { Authorization: string; }; export declare function getHeadersForChunkUpload(token: string): { Authorization: string; 'content-type': string; }; export declare function getHeadersForMkFile(token: string): { Authorization: string; 'content-type': string; }; export declare function createXHR(): XMLHttpRequest; export declare function computeMd5(data: Blob): Promise<string>; export declare function readAsArrayBuffer(data: Blob): Promise<ArrayBuffer>; export interface ResponseSuccess<T> { data: T; reqId: string; } export declare type XHRHandler = (xhr: XMLHttpRequest) => void; export interface RequestOptions { method: string; onProgress?: (data: Progress) => void; onCreate?: XHRHandler; body?: BodyInit | null; headers?: { [key: string]: string; }; } export declare type Response<T> = Promise<ResponseSuccess<T>>; export declare function request<T>(url: string, options: RequestOptions): Response<T>; export declare function getPortFromUrl(url: string | undefined): string; export declare function getDomainFromUrl(url: string | undefined): string; interface PutPolicy { assessKey: string; bucketName: string; scope: string; } export declare function getPutPolicy(token: string): PutPolicy; export declare function createObjectURL(file: File): string; export {};