ReadFiles

Reads the content of files from the file system into the content of new documents.
For each output document, several metadata values are set with information about the file. This module will be executed once and input documents will be ignored if search patterns are specified. Otherwise, if a delegate is specified, the module will be executed once per input document and the resulting output documents will be aggregated. In either case, the input documents will not be returned as output of this module. If you want to add additional files to a current pipeline, you should enclose your ReadFiles modules with Concat.

Usage

  • ReadFiles(ContextConfig patterns)

    Reads all files that match the specified globbing patterns and/or absolute paths. This allows you to specify different patterns and/or paths depending on the context.

    • patterns

      A delegate that returns one or more globbing patterns and/or absolute paths.

  • ReadFiles(DocumentConfig patterns)

    Reads all files that match the specified globbing patterns and/or absolute paths. This allows you to specify different patterns and/or paths depending on the input.

    • patterns

      A delegate that returns one or more globbing patterns and/or absolute paths.

  • ReadFiles(params string[] patterns)

    Reads all files that match the specified globbing patterns and/or absolute paths.

    • patterns

      The globbing patterns and/or absolute paths to read.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • Where(Func<IFile, bool> predicate)

    Specifies a predicate that must be satisfied for the file to be read.

    • predicate

      A predicate that returns true if the file should be read.

Metadata

The following metadata is added to each document.

  • RelativeFileDir: DirectoryPath

    The relative directory of the file from the Wyam input folder.

  • RelativeFilePath: FilePath

    The relative path to the file (including file name) from the Wyam input folder.

  • RelativeFilePathBase: FilePath

    The relative path to the file (including file name) from the Wyam input folder without the file extension.

  • SourceFileBase: FilePath

    The file name without any extension. Equivalent to Path.GetFileNameWithoutExtension(SourceFilePath).

  • SourceFileDir: DirectoryPath

    The full absolute directory of the file. Equivalent to Path.GetDirectoryName(SourceFilePath).

  • SourceFileExt: string

    The extension of the file. Equivalent to Path.GetExtension(SourceFilePath).

  • SourceFileName: FilePath

    The full file name. Equivalent to Path.GetFileName(SourceFilePath).

  • SourceFilePath: FilePath

    The full absolute path of the file (including file name).

  • SourceFilePathBase: FilePath

    The full absolute path of the file (including file name) without the file extension.

  • SourceFileRoot: DirectoryPath

    The absolute root search path without any nested directories (I.e., the path that was searched, and possibly descended, for the given pattern).

GitHub