pyodide/file-loader/file-loader.js - File Loader
Location: src/pyodide/file-loader/file-loader.js
This file contains the PyodideFileLoader class, which is responsible for fetching remote files and loading them into the Pyodide virtual filesystem.
Class: PyodideFileLoader
constructor(filesToLoad)
- Description: Creates a new
PyodideFileLoaderinstance. - Parameters:
filesToLoad(Array
- Throws:
Errorif thefilesToLoadargument is invalid.
loadFiles(pyodide, options)
- Description: Asynchronously fetches each file specified in the constructor and writes it to the Pyodide filesystem. It includes a retry mechanism with exponential backoff to handle transient network errors.
- Parameters:
pyodide(PyodideAPI): The Pyodide instance.options(Object, optional): An object to configure the loading process, includingmaxRetriesandretryDelay.
- Throws:
Errorif a file fails to load after all retry attempts.