@servicenow/sdk - v4.4.1
    Preparing search index...

    Represents a file system that can be interacted with.

    interface FileSystemHost {
        copy(srcPath: string, destPath: string): Promise<void>;
        copySync(srcPath: string, destPath: string): void;
        delete(path: string): Promise<void>;
        deleteSync(path: string): void;
        directoryExists(dirPath: string): Promise<boolean>;
        directoryExistsSync(dirPath: string): boolean;
        fileExists(filePath: string): Promise<boolean>;
        fileExistsSync(filePath: string): boolean;
        getCurrentDirectory(): string;
        glob(patterns: readonly string[]): Promise<string[]>;
        globSync(patterns: readonly string[]): string[];
        isCaseSensitive(): boolean;
        mkdir(dirPath: string): Promise<void>;
        mkdirSync(dirPath: string): void;
        move(srcPath: string, destPath: string): Promise<void>;
        moveSync(srcPath: string, destPath: string): void;
        readDirSync(dirPath: string): RuntimeDirEntry[];
        readFile(filePath: string, encoding?: string): Promise<string>;
        readFileSync(filePath: string, encoding?: string): string;
        realpathSync(path: string): string;
        writeFile(filePath: string, fileText: string): Promise<void>;
        writeFileSync(filePath: string, fileText: string): void;
    }

    Implemented by

    Index

    Methods

    • Asynchronously copies a file or directory.

      Parameters

      • srcPath: string
      • destPath: string

      Returns Promise<void>

    • Synchronously copies a file or directory.

      Parameters

      • srcPath: string
      • destPath: string

      Returns void

    • Asynchronously deletes the specified file or directory.

      Parameters

      • path: string

      Returns Promise<void>

    • Synchronously deletes the specified file or directory

      Parameters

      • path: string

      Returns void

    • Asynchronously checks if a directory exists.

      Parameters

      • dirPath: string

      Returns Promise<boolean>

    • Synchronously checks if a directory exists.

      Parameters

      • dirPath: string

      Returns boolean

    • Asynchronously checks if a file exists.

      Parameters

      • filePath: string

      Returns Promise<boolean>

      Implementers should throw an errors.FileNotFoundError when it does not exist.

    • Synchronously checks if a file exists.

      Parameters

      • filePath: string

      Returns boolean

      Implementers should throw an errors.FileNotFoundError when it does not exist.

    • Gets the current directory of the environment.

      Returns string

    • Uses pattern matching to find files or directories.

      Parameters

      • patterns: readonly string[]

      Returns Promise<string[]>

    • Synchronously uses pattern matching to find files or directories.

      Parameters

      • patterns: readonly string[]

      Returns string[]

    • Gets if this file system is case sensitive.

      Returns boolean

    • Asynchronously creates a directory at the specified path.

      Parameters

      • dirPath: string

      Returns Promise<void>

    • Synchronously creates a directory at the specified path.

      Parameters

      • dirPath: string

      Returns void

    • Asynchronously moves a file or directory.

      Parameters

      • srcPath: string
      • destPath: string

      Returns Promise<void>

    • Synchronously moves a file or directory.

      Parameters

      • srcPath: string
      • destPath: string

      Returns void

    • Reads all the child directories and files.

      Parameters

      • dirPath: string

      Returns RuntimeDirEntry[]

      Implementers should have this return the full file path.

    • Asynchronously reads a file at the specified path.

      Parameters

      • filePath: string
      • Optionalencoding: string

      Returns Promise<string>

    • Synchronously reads a file at the specified path.

      Parameters

      • filePath: string
      • Optionalencoding: string

      Returns string

    • Asynchronously writes a file to the file system.

      Parameters

      • filePath: string
      • fileText: string

      Returns Promise<void>

    • Synchronously writes a file to the file system.

      Parameters

      • filePath: string
      • fileText: string

      Returns void