CoolFace
Apppublic

Nymbo/self-hosted-python

sourceHugging Faceupdated 4y agoView on Hugging Face
1likes
load-pyodide.d.ts49 linesDownload Raw Back to root
1/**2 * @param {string} indexURL3 * @private4 */5export function initializePackageIndex(indexURL: string): Promise<void>;6export function _fetchBinaryFile(indexURL: any, path: any): Promise<ArrayBufferLike>;7/**8 * @callback LogFn9 * @param {string} msg10 * @returns {void}11 * @private12 */13/**14 * Load a package or a list of packages over the network. This installs the15 * package in the virtual filesystem. The package needs to be imported from16 * Python before it can be used.17 *18 * @param {string | string[] | PyProxy} names Either a single package name or19 * URL or a list of them. URLs can be absolute or relative. The URLs must have20 * file name ``<package-name>.js`` and there must be a file called21 * ``<package-name>.data`` in the same directory. The argument can be a22 * ``PyProxy`` of a list, in which case the list will be converted to JavaScript23 * and the ``PyProxy`` will be destroyed.24 * @param {LogFn=} messageCallback A callback, called with progress messages25 *    (optional)26 * @param {LogFn=} errorCallback A callback, called with error/warning messages27 *    (optional)28 * @async29 */30export function loadPackage(names: string | string[] | PyProxy, messageCallback?: LogFn | undefined, errorCallback?: LogFn | undefined): Promise<void>;31/**32 * @param {string) url33 * @async34 * @private35 */36export let loadScript: any;37/**38 *39 * The list of packages that Pyodide has loaded.40 * Use ``Object.keys(pyodide.loadedPackages)`` to get the list of names of41 * loaded packages, and ``pyodide.loadedPackages[package_name]`` to access42 * install location for a particular ``package_name``.43 *44 * @type {object}45 */46export let loadedPackages: object;47export type LogFn = (msg: string) => void;48export type PyProxy = any;49