Class IStaticDirectoryExtensions
Extension methods for IStaticDirectory.
Namespace: Neon.Common
Assembly: Neon.Common.dll
Syntax
public static class IStaticDirectoryExtensions
Methods
Zip(IStaticDirectory, Stream, string, SearchOption, StaticZipOptions)
Writes a ZIP file to a stream, including the selected files from the static directory.
Declaration
public static void Zip(this IStaticDirectory directory, Stream zipStream, string searchPattern = null, SearchOption searchOptions = SearchOption.TopDirectoryOnly, StaticZipOptions zipOptions = StaticZipOptions.None)
Parameters
Type | Name | Description |
---|---|---|
IStaticDirectory | directory | The static directory instance. |
Stream | zipStream | The output stream. |
string | searchPattern | Optionally specifies a file name pattern using standard file system wildcards like [*] and [?]. This defaults to including all files. |
SearchOption | searchOptions | Optionally perform a recursive search. This defaults to TopDirectoryOnly. |
StaticZipOptions | zipOptions | Additional options that control things like whether the files are zipped within the parent directory or whether the files are assumed to contain UTF-8 text and that Windows style CRLF line endings are to be converted to Linux compatible LF endings. You can combine options by bitwise ORing them. This defaults to None. |
Remarks
note
The current implementation loads the files into memory so this isn't really suitable for zipping very large files.
Zip(IStaticDirectory, string, string, SearchOption, StaticZipOptions)
Creates a ZIP file, including the selected files from the static directory.
Declaration
public static void Zip(this IStaticDirectory directory, string zipPath, string searchPattern = null, SearchOption searchOptions = SearchOption.TopDirectoryOnly, StaticZipOptions zipOptions = StaticZipOptions.None)
Parameters
Type | Name | Description |
---|---|---|
IStaticDirectory | directory | The static directory instance. |
string | zipPath | Path to the output ZIP file. |
string | searchPattern | Optionally specifies a file name pattern using standard file system wildcards like [*] and [?]. This defaults to including all files. |
SearchOption | searchOptions | Optionally perform a recursive search. This defaults to TopDirectoryOnly. |
StaticZipOptions | zipOptions | Additional options that control things like whether the files are zipped within the parent directory or whether the files are assumed to contain UTF-8 text and that Windows style CRLF line endings are to be converted to Linux compatible LF endings. You can combine options by bitwise ORing them. This defaults to None. |