FulcrumFS FulcrumFS
FulcrumFS FulcrumFS
DocFX + Singulink = ♥

Search Results for

    Class FileFormat

    Represents a file format that can be used to validate that a file's content matches its declared extension.

    Inheritance
    object
    FileFormat
    Namespace: FulcrumFS
    Assembly: FulcrumFS.Core.dll
    Syntax
    public abstract class FileFormat
    Remarks

    Each FileFormat represents one specific file format with a fixed set of extensions. The base library provides built-in singletons for common formats accessible via static properties (Jpeg, Png, Pdf, etc.).

    Content-agnostic and text-based file formats can be created using the factory methods (AnyContent(params ReadOnlySpan<string>), TextAscii(params ReadOnlySpan<string>), TextUnicode(params ReadOnlySpan<string>), TextEncoding(Encoding, params ReadOnlySpan<string>)) where the caller specifies the applicable extensions.

    Custom file formats can be created by deriving from FileFormat and implementing ValidateAsync(Stream, CancellationToken).

    FileFormat is independent of the FulcrumFS repository infrastructure and can be used standalone — for example, to validate user uploads in a front-end application before sending them to a service that hosts a FulcrumFS repository.

    Constructors

    Name Description
    FileFormat()

    Initializes a new instance of the FileFormat class.

    Properties

    Name Description
    Avi

    Gets the AVI media file format. Extension: .avi.

    Avif

    Gets the AVIF image file format. Extension: .avif.

    Bmp

    Gets the BMP image file format. Extensions: .bmp (primary), .bm, .dip.

    Doc

    Gets the legacy Microsoft Word (DOC) file format. Extension: .doc. Validates the OLE Compound Document signature and verifies the contained document is a Word document by inspecting the directory entries for the 'WordDocument' stream.

    Docx

    Gets the DOCX (Office Open XML Word document) file format. Extension: .docx.

    Epub

    Gets the EPUB e-book file format. Extension: .epub.

    Extensions

    Gets the file extensions associated with this file format (including the leading dot, e.g., ".jpg").

    Flac

    Gets the FLAC audio file format. Extension: .flac.

    Gif

    Gets the GIF image file format. Extension: .gif.

    Heic

    Gets the HEIC image file format. Extension: .heic.

    Heif

    Gets the HEIF image file format. Extensions: .heif (primary), .heifs, .hif.

    Jpeg

    Gets the JPEG image file format. Extensions: .jpg (primary), .jpeg, .jfif.

    M2ts

    Gets the MPEG-TS (192-byte packet, Blu-ray style) media file format. Extensions: .m2ts (primary), .mts.

    M4a

    Gets the MPEG-4 audio (M4A) media file format. Extension: .m4a.

    Mj2

    Gets the Motion JPEG 2000 (MJ2) media file format. Extension: .mj2.

    Mkv

    Gets the Matroska (MKV) media file format. Extension: .mkv.

    Mov

    Gets the QuickTime (MOV) media file format. Extension: .mov.

    Mp3

    Gets the MP3 audio file format. Extension: .mp3.

    Mp4

    Gets the MP4 media file format. Extension: .mp4.

    Mpeg

    Gets the MPEG-PS media file format. Extensions: .mpg (primary), .mpeg.

    Name

    Gets the name of the file format (e.g., "JPEG", "PDF", "TextUnicode").

    Odp

    Gets the ODP (OpenDocument presentation) file format. Extension: .odp.

    Ods

    Gets the ODS (OpenDocument spreadsheet) file format. Extension: .ods.

    Odt

    Gets the ODT (OpenDocument text) file format. Extension: .odt.

    Ogg

    Gets the Ogg media file format. Extensions: .ogg (primary), .oga, .ogv, .opus.

    Pdf

    Gets the PDF document file format. Extension: .pdf.

    Png

    Gets the PNG image file format. Extensions: .png (primary), .apng.

    Ppt

    Gets the legacy Microsoft PowerPoint (PPT) file format. Extension: .ppt. Validates the OLE Compound Document signature and verifies the contained document is a PowerPoint presentation by inspecting the directory entries for the 'PowerPoint Document' stream.

    Pptx

    Gets the PPTX (Office Open XML presentation) file format. Extension: .pptx.

    PrimaryExtension

    Gets the primary file extension associated with this file format (including the leading dot). This is the first extension in Extensions and is the extension that files of this format are written with when added to a FulcrumFS repository.

    Rtf

    Gets the RTF document file format. Extension: .rtf.

    Tg2

    Gets the 3GPP2 (3G2) media file format. Extension: .3g2.

    Tgp

    Gets the 3GPP (3GP) media file format. Extension: .3gp.

    Tiff

    Gets the TIFF image file format. Extensions: .tif (primary), .tiff.

    Ts

    Gets the MPEG-TS (188-byte packet) media file format. Extension: .ts.

    Wav

    Gets the WAV audio file format. Extension: .wav.

    WebM

    Gets the WebM media file format. Extension: .webm.

    WebP

    Gets the WebP image file format. Extension: .webp.

    Xls

    Gets the legacy Microsoft Excel (XLS) file format. Extension: .xls. Validates the OLE Compound Document signature and verifies the contained document is an Excel workbook by inspecting the directory entries for the 'Workbook' or 'Book' stream.

    Xlsx

    Gets the XLSX (Office Open XML spreadsheet) file format. Extension: .xlsx.

    Zip

    Gets the ZIP archive file format. Extension: .zip.

    Methods

    Name Description
    AnyContent(params ReadOnlySpan<string>)

    Creates a FileFormat that accepts any content for the specified extensions. No content validation is performed beyond ensuring the file's extension is one of the specified extensions.

    TextAscii(params ReadOnlySpan<string>)

    Creates a FileFormat that validates files are valid ASCII text for the specified extensions. All bytes in the file must be in the range [0, 127] (i.e. IsValid(ReadOnlySpan<byte>) must return true).

    TextEncoding(Encoding, params ReadOnlySpan<string>)

    Creates a FileFormat that validates files decode successfully using the specified Encoding, for the specified extensions.

    TextUnicode(UnicodeEncodings, params ReadOnlySpan<string>)

    Creates a FileFormat that validates files are valid Unicode text in one of the specified encodings, for the specified extensions.

    TextUnicode(params ReadOnlySpan<string>)

    Creates a FileFormat that validates files are valid Unicode text in any encoding supported by All, for the specified extensions.

    ToString()

    Returns a string that represents the current object.

    ValidateAsync(Stream, CancellationToken)

    Validates the content of the specified stream against this file format. The stream must be seekable and positioned at 0 at the start of this call.

    © Singulink. All rights reserved.