UnwrittenFiles Class

Summary

Outputs only those documents that have not yet been written to the file system.
Assembly
Wyam.Core.dll
Namespace
Wyam.Core.Modules.IO
Interfaces
Base Types
graph BT Type-->Base0["WriteFiles"] click Base0 "/api/Wyam.Core.Modules.IO/WriteFiles" Base0-->Base1["Object"] Type-.->Interface0["IModule"] click Interface0 "/api/Wyam.Common.Modules/IModule" Type["UnwrittenFiles"] class Type type-node

Syntax

public class UnwrittenFiles : WriteFiles, IModule

Remarks

The constructors and file resolution logic follows the same semantics as Wyam.Core.Modules.IO.WriteFiles. This module is useful for eliminating documents from the pipeline on subsequent runs depending on if they've already been written to disk. For example, you might want to put this module right after Wyam.Core.Modules.IO.ReadFiles for a pipeline that does a lot of expensive image processing since there's no use in processing images that have already been processed. Note that only the file name is checked and that this module cannot determine if the content would have been the same had a document not been removed from the pipeline. Also note that you should only use this module if you're sure that no other pipelines rely on the output documents. Because this module removes documents from the pipeline, those documents will never reach the end of the pipeline and any other modules or pages that rely on them (for example, an image directory) will not be correct.

Constructors

Name Summary
UnwrittenFiles() Writes the document content to disk with the same file name and relative path as the input file. This requires metadata for RelativeFilePath to be set (which is done by default by the Wyam.Core.Modules.IO.ReadFiles module).
UnwrittenFiles(DocumentConfig) Uses a delegate to describe where to write the content of each document. The output of the function should be either a full path to the disk location (including file name) or a path relative to the output folder.
UnwrittenFiles(string) Writes the document content to disk with the specified extension with the same base file name and relative path as the input file. This requires metadata for RelativeFilePath to be set (which is done by default by the Wyam.Core.Modules.IO.ReadFiles module).

Methods

Name Value Summary
Append(bool) WriteFiles
Appends content to each file instead of overwriting them.
Inherited from WriteFiles
Execute(IReadOnlyList<IDocument>, IExecutionContext) IEnumerable<IDocument>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
GetOutputPath(IDocument, IExecutionContext) FilePath
Gets the output path of the input document.
Inherited from WriteFiles
IgnoreEmptyContent(bool) WriteFiles
Ignores documents with empty content, which is the default behavior.
Inherited from WriteFiles
OnlyMetadata(bool) WriteFiles
Indicates that only metadata should be added to the document and a file should not actually be written to the file system. This is useful for preprocessing documents so they appear in a pipeline with the correct write metadata, while actually writing them later with a second Wyam.Core.Modules.IO.WriteFiles module invocation. Only the following metadata values are written when this flag is turned on: WritePath, RelativeFilePath, RelativeFilePathBase, and RelativeFileDir. The Destination... metadata values are not added to the document when only setting metadata..
Inherited from WriteFiles
ShouldProcess(IDocument, IExecutionContext) bool
Checks whether the input document should be processed.
Inherited from WriteFiles
UseWriteMetadata(bool) WriteFiles
By default the metadata values for WritePath, WriteFileName, and WriteExtension are checked and used first, even if a delegate is specified in the constructor. This method can be used to turn off the default behavior and always rely on the delegate for obtaining the write location.
Inherited from WriteFiles
Where(DocumentConfig) WriteFiles
Specifies a predicate that must be satisfied for the file to be written.
Inherited from WriteFiles
GitHub