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 Wyam.Core.Modules.Control.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.

Output Metadata

The metadata values listed below apply to individual documents and are created and set by the module as indicated in their descriptions.

  • Keys.RelativeFileDir: Wyam.Common.IO.DirectoryPath

    The path to the folder containing the file relative to the input folder.

  • Keys.RelativeFilePath: Wyam.Common.IO.FilePath

    The path to the file relative to the input folder. This metadata value is used when generating links to the document.

  • Keys.RelativeFilePathBase: Wyam.Common.IO.FilePath

    The path to the file relative to the input folder without extension.

  • Keys.SourceFileBase: Wyam.Common.IO.FilePath

    The name of the original file without extension.

  • Keys.SourceFileDir: Wyam.Common.IO.DirectoryPath

    The absolute path to the folder of the original file.

  • Keys.SourceFileExt: System.String

    The extension of the original file (including the ".").

  • Keys.SourceFileName: Wyam.Common.IO.FilePath

    The file name of the original file with extension.

  • Keys.SourceFilePath: Wyam.Common.IO.FilePath

    The absolute path to the original file.

  • Keys.SourceFilePathBase: Wyam.Common.IO.FilePath

    The absolute path to the original file without the file extension.

  • Keys.SourceFileRoot: Wyam.Common.IO.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