UNPKG

npaw-plugin-nwf

Version:
34 lines (33 loc) 1.58 kB
import Cdn from './../Loaders/Cdn'; export default class Utils { static getRouteAndFilename(stringUrl: string): { route: string; fileName: string; }; static getPath(stringUrl: string): { path: string; }; static delay(milliseconds: number): Promise<unknown>; /** * High-resolution monotonic timestamp in milliseconds (sub-ms precision when * available). Mirrors Android `System.nanoTime()` usage from * plugin-android@feff14fd to escape the 1ms floor of `Date.now()`: a cached/ * LAN-proxy CDN can complete a chunk in <1ms, which previously saturated the * bandwidth estimate at `bytes * 8000`. Use this for elapsed-time math * (segment download time, bandwidth derivation). Falls back to `Date.now()` * on environments without `performance` (e.g. older WebViews, NWF). */ static nowMs(): number; static findPathMach(url: string, path: string, newCdn: Cdn): string; static sliceByFirstSpecial(str: string, splitBySpecial?: boolean): string; static isMedia(path: string): boolean; static isManifest(path: string, splitBySpecial?: boolean): boolean; static isAudio(path: string): boolean; static isSubtitles(path: string): boolean; static bufferToString(b: ArrayBuffer): string; static returnRandom(a: string[]): string; static formatParameters(params: any): string; static ifByteArrayToString(data: any): string; static isValidUrl(urlString: string): boolean; static isHeaderMatch(headerValue: string, headerInfo: cacheHeaderBehavior): boolean; }