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

    Interface FileSystem

    A file system API based on a subset of the fs module from Node.js.

    interface FileSystem {
        accessSync(path: string): void;
        copyFileSync(srcPath: string, destPath: string): void;
        lstatSync(path: string): Stats;
        mkdirSync(path: string): void;
        mkdirSync(path: string, options: { recursive: true }): string | undefined;
        mkdirSync(
            path: string,
            options?: { recursive: boolean },
        ): string | undefined;
        readdirSync(path: string): string[];
        readdirSync(path: string, options: { withFileTypes: true }): Entry[];
        readdirSync(
            path: string,
            options?: { withFileTypes: boolean },
        ): string[] | Entry[];
        readFileSync(path: string, options?: { flag: "r" }): Buffer;
        readFileSync(
            path: string,
            options: { encoding: Encoding; flag?: "r" },
        ): string;
        readFileSync(
            path: string,
            options?: { encoding?: Encoding; flag?: "r" },
        ): string | Buffer<ArrayBufferLike>;
        realpathSync(path: string): string;
        renameSync(oldPath: string, newPath: string): void;
        rmSync(
            path: string,
            options?: { force?: boolean; recursive?: boolean },
        ): void;
        statSync(path: string): Stats;
        writeFileSync(
            path: string,
            content: string | ArrayBufferView<ArrayBufferLike>,
            options?: { encoding: Encoding },
        ): void;
    }
    Index

    Methods

    • Synchronously checks if the file or directory at the provided path is accessible. If it is accessible, the method does nothing. If it is not accessible, an error is thrown.

      Parameters

      • path: string

      Returns void

    • Synchronously copies the file at the source path to the destination path.

      Parameters

      • srcPath: string
      • destPath: string

      Returns void

    • Synchronously retrieves the status of the file or directory at the provided path. Does not dereference symbolic links.

      Parameters

      • path: string

      Returns Stats

    • Synchronously creates a directory at the provided path.

      If options.recursive is true, the full path will be created including any missing parent directories, and the path of the first directory created will be returned. Otherwise, returns undefined.

      Parameters

      • path: string

      Returns void

    • Parameters

      • path: string
      • options: { recursive: true }

      Returns string | undefined

    • Parameters

      • path: string
      • Optionaloptions: { recursive: boolean }

      Returns string | undefined

    • Synchronously reads the contents of the directory at the provided path.

      If options.withFileTypes is true, returns the contents as an array of Entry objects. Otherwise, returns the contents as an array of strings containing the names of each entry.

      Parameters

      • path: string

      Returns string[]

    • Parameters

      • path: string
      • options: { withFileTypes: true }

      Returns Entry[]

    • Parameters

      • path: string
      • Optionaloptions: { withFileTypes: boolean }

      Returns string[] | Entry[]

    • Synchronously reads the contents of the file at the provided path.

      If options.encoding is provided, the contents will be returned as a string. Otherwise, the contents will be returned as a Buffer.

      Parameters

      • path: string
      • Optionaloptions: { flag: "r" }

      Returns Buffer

    • Parameters

      • path: string
      • options: { encoding: Encoding; flag?: "r" }

      Returns string

    • Parameters

      • path: string
      • Optionaloptions: { encoding?: Encoding; flag?: "r" }

      Returns string | Buffer<ArrayBufferLike>

    • Synchronously computes the canonical path by resolving ., .. and symbolic links.

      Parameters

      • path: string

      Returns string

    • Synchronously renames the file or directory at the old path to the new path.

      Parameters

      • oldPath: string
      • newPath: string

      Returns void

    • Synchronously deletes the file or directory at the provided path.

      Parameters

      • path: string
      • Optionaloptions: { force?: boolean; recursive?: boolean }

      Returns void

    • Synchronously retrieves the status of the file or directory at the provided path.

      Parameters

      • path: string

      Returns Stats

    • Synchronously writes the provided content to the file at the provided path.

      Parameters

      • path: string
      • content: string | ArrayBufferView<ArrayBufferLike>
      • Optionaloptions: { encoding: Encoding }

      Returns void