vlocode-project - v1.40.0-beta-4
    Preparing search index...

    Class NodeFileSystem

    Basic class that can wrap any API implementation the NodeJS FS API into a more reduced FileSystem interface.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    innerFs: __module = fs

    Methods

    • Append data to an existing file to the file system, when the directory does not exists it will be created.

      Parameters

      • path: string

        path to the file to read

      • body: string | Buffer<ArrayBufferLike>

        body to write to the file

      • Optionaloptions: OutputOptions

        write options

      Returns Promise<void>

    • Create a new directory at the specified path. No error should be thrown when the directory already exists. Operations should be idempotent and recursive, so when creating a directory /a/b/c and /a or /a/b do not exists, these should be created as well.

      Parameters

      • path: string

        path to the directory to create

      Returns Promise<void>

    • Find files and or folders matching the specified glob pattern as an async iterable. If the result is not iterated completely, the search is stopped. When you need the results as an array, use the Iterable.spreadAsync method to convert the async iterable into an array.

      By default the current working directory is used as the base directory for the search.

      You can specify multiple glob patterns to match by specifying an array of glob patterns.

      When a limit is specified, the search is stopped after the specified number of results is reached.

      When a depth is specified, the search does not go deeper than the specified depth.

      Parameters

      • patterns: GlobPatterns

        Glob patterns to match

      • Optionaloptions: FindOptions

        find options

      Returns AsyncGenerator<string>

      Async iterable of matching files and or folders

      for await (const file of fs.find('*.ts')) {
      console.log(file);
      }
    • Find files matching the specified glob pattern(s)

      Parameters

      • globPatterns: string | string[]

        Glob patterns to match files with

      Returns Promise<string[]>

    • Returns {
          lstat: typeof lstat;
          lstatSync: any;
          readdir: typeof readdir;
          readdirSync: {
              (
                  path: PathLike,
                  options?:
                      | null
                      | BufferEncoding
                      | {
                          encoding: BufferEncoding | null;
                          recursive?: boolean;
                          withFileTypes?: false;
                      },
              ): string[];
              (
                  path: PathLike,
                  options:
                      | "buffer"
                      | { encoding: "buffer"; recursive?: boolean; withFileTypes?: false },
              ): Buffer<ArrayBufferLike>[];
              (
                  path: PathLike,
                  options?:
                      | null
                      | BufferEncoding
                      | ObjectEncodingOptions & { recursive?: boolean; withFileTypes?: false },
              ): string[] | Buffer<ArrayBufferLike>[];
              (
                  path: PathLike,
                  options: ObjectEncodingOptions & {
                      recursive?: boolean;
                      withFileTypes: true;
                  },
              ): Dirent<string>[];
              (
                  path: PathLike,
                  options: { encoding: "buffer"; recursive?: boolean; withFileTypes: true },
              ): Dirent<Buffer<ArrayBufferLike>>[];
          };
          stat: typeof stat;
          statSync: any;
      }

      • lstat: typeof lstat
      • lstatSync: any
      • readdir: typeof readdir
      • readdirSync: {
            (
                path: PathLike,
                options?:
                    | null
                    | BufferEncoding
                    | {
                        encoding: BufferEncoding | null;
                        recursive?: boolean;
                        withFileTypes?: false;
                    },
            ): string[];
            (
                path: PathLike,
                options:
                    | "buffer"
                    | { encoding: "buffer"; recursive?: boolean; withFileTypes?: false },
            ): Buffer<ArrayBufferLike>[];
            (
                path: PathLike,
                options?:
                    | null
                    | BufferEncoding
                    | ObjectEncodingOptions & { recursive?: boolean; withFileTypes?: false },
            ): string[] | Buffer<ArrayBufferLike>[];
            (
                path: PathLike,
                options: ObjectEncodingOptions & {
                    recursive?: boolean;
                    withFileTypes: true;
                },
            ): Dirent<string>[];
            (
                path: PathLike,
                options: { encoding: "buffer"; recursive?: boolean; withFileTypes: true },
            ): Dirent<Buffer<ArrayBufferLike>>[];
        }
      • stat: typeof stat
      • statSync: any
    • Returns true if the path exists and is a folder, returns false when the path does not exists or is not a folder.

      Parameters

      • path: string

        Path to check

      Returns Promise<boolean>

    • Returns true if the path exists and is a file, returns false when the path does not exists or is not a file.

      Parameters

      • path: string

        Path to check

      Returns Promise<boolean>

    • Write a file to the file system, when the directory does not exists it will be created.

      Parameters

      • path: string

        path to the file to read

      • Optionalbody: string | Buffer<ArrayBufferLike>

        body to write to the file

      • Optionaloptions: OutputOptions

        write options

      Returns Promise<void>

    • Write a file to the file system, when the directory does not exists it will be created.

      Parameters

      • path: string

        path to the file to read

      • Optionaldata: string | Buffer<ArrayBufferLike>

        data to write to the file

      • Optionaloptions: WriteOptions

        write options

      Returns Promise<void>