import { IOHandler, LoadOptions, ModelArtifacts, ModelArtifactsInfo, ModelJSON, OnProgressCallback } from "@tensorflow/tfjs-core/dist/io/types"; export declare class JSONHandler implements IOHandler { json: ModelJSON; path: string; weightPathPrefix: string; requestInit: RequestInit; fetch: typeof fetch; onProgress: OnProgressCallback; weightUrlConverter: ((path: string) => Promise) | null; constructor(json: ModelJSON); load(): Promise; private loadWeights; } /** * Extract the prefix and suffix of the url, where the prefix is the path before * the last file, and suffix is the search params after the last file. * ``` * const url = 'http://tfhub.dev/model/1/tensorflowjs_model.pb?tfjs-format=file' * [prefix, suffix] = parseUrl(url) * // prefix = 'http://tfhub.dev/model/1/' * // suffix = '?tfjs-format=file' * ``` * @param url the model url to be parsed. */ export declare function parseUrl(url: string): [string, string]; /** * Calculate the byte length of a JavaScript string. * * Note that a JavaScript string can contain wide characters, therefore the * length of the string is not necessarily equal to the byte length. * * @param str Input string. * @returns Byte length. */ export declare function stringByteLength(str: string): number; /** * Populate ModelArtifactsInfo fields for a model with JSON topology. * @param modelArtifacts * @returns A ModelArtifactsInfo object. */ export declare function getModelArtifactsInfoForJSON(modelArtifacts: ModelArtifacts): ModelArtifactsInfo; /** * Concatenate a number of ArrayBuffers into one. * * @param buffers A number of array buffers to concatenate. * @returns Result of concatenating `buffers` in order. */ export declare function concatenateArrayBuffers(buffers: ArrayBuffer[]): ArrayBuffer; /** * Reads binary weights data from a number of URLs. * * @param fetchURLs URLs to send the HTTP requests at, using `fetch` calls. * @param requestOptions RequestInit (options) for the HTTP requests. * @param fetchFunc Optional overriding value for the `window.fetch` function. * @param onProgress Optional, progress callback function, fired periodically * before the load is completed. * @returns A `Promise` of an Array of `ArrayBuffer`. The Array has the same * length as `fetchURLs`. */ export declare function loadWeightsAsArrayBuffer(fetchURLs: string[], loadOptions?: LoadOptions): Promise;