H5P NodeJS Library
    Preparing search index...

    An interface for a file sanitizer that can sanitize files that can potentially contain dangerous elements. In contrast to a malware scanner, a sanitizer can remove potentially dangerous parts of the file and keep the rest usable. It never rejects files because of its contents, but simply removes dangerous parts. Due to the nature how sanitizers work, they typically always change something in the file, even if it is just removing whitespaces. That's why there is no reliable way to determine if a file was really dangerous or not and nothing is reported to the user.

    interface IFileSanitizer {
        name: string;
        sanitize(file: string): Promise<FileSanitizerResult>;
    }

    Implemented by

    Index

    Properties

    Methods

    Properties

    name: string

    The name of the scanner, e.g. SVG Sanitizer. Used in debug output

    Methods

    • Sanitizes files. The original file is expected to be replaced by the sanitized file, so there is no new path to the sanitized file.

      Parameters

      • file: string

      Returns Promise<FileSanitizerResult>