Skip to content

InputStream API

Enter your Module ID

$module_id ($bindhosts) is a sanitized version of the module ID. It is used to create unique variable names in JavaScript. The sanitized version replaces any non-alphanumeric characters with underscores and prefixes the ID with a dollar sign.

  • window.$bindhosts - ModuleInterface
  • window.$BiFile - FileManager
  • window.$BiFileInputStream - FileInputInterface
ts
import { FileInputInterfaceStream } from "./FileInputInterfaceStream";

declare var $module_id: FileInputInterface; // accesspoint for webui-x

export interface FileInputInterface {
  /**
   * Opens a file for reading.
   * @param path The path to the file to be opened.
   * @returns A FileInputInterfaceStream object if the file is opened successfully, null otherwise.
   */
  open(path: string): FileInputInterfaceStream | null;
}
ts
/**
 * This is a private interface which is not accessible in the window object.
 * It is used to define the structure of a file input stream.
 */
export interface FileInputInterfaceStream {
  read(): number;
  readChunk(chinkSize: number): number;
  close(): void;
  skip(n: number): number;
}

Released under the GPL3 License.