reckfellENGINE

FileAccess

File access with explicit modes, byte formats and error checks.

On this page
class FileAccessReckfellSharpInherits RefCounted

FileAccess reads and writes OS paths, asset:// and user://. Use user:// for progress; load imported project assets through ResourceLoader instead of assuming original files remain accessible after export.

Check Open() for null and immediately read GetOpenError() on the same thread. Release owned handles with using. Write/WriteRead truncate existing files; ReadWrite retains contents and starts at position 0. Create parent directories separately.

Positions and lengths are bytes. Check actual GetBuffer() length and write results; a numeric value or empty string alone proves no success. GetAsText() reads the whole file and restores the cursor; EofReached() indicates reading past end. BigEndian concerns numeric fields, not arbitrary bytes/UTF-8.

Behavior depends on the handle: ordinary Windows Flush() flushes output buffering, while compressed/encrypted containers retain writes in memory until close. None is a general power-loss guarantee. Encrypted Write has a reproduced limitation: an invalid key can be detected after destination truncation.

UTF-8 reading and diagnosis, binary slot, saving with a backup. Tests ran on Windows in isolated projects; temporary files were source-reviewed, while encryption security and other platforms were not certified.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Properties1

BigEndianProperty
# BigEndian
C#
public bool BigEndian { get; set; }

Byte-order setting for numeric Get/Store operations on this handle: false is little-endian, true big-endian. A new Open() has a fresh false-default handle; the setting is not stored as file metadata. Does not reorder GetBuffer/StoreBuffer bytes or UTF-8 text. StoreVar/GetVar applies it to the 32-bit length prefix, not the inner Variant payload; tested. Reader and writer must agree on the format.

Methods76

Closevoid
# Close
C#
public void Close();

Closes this handle file; using/Dispose of an owned wrapper also ends its use. Do not read, seek or call EofReached() after closing. Repeated Close() was tested on Windows, but does not reopen; Open() creates another handle. Returns no Error, so closing does not certify reliable persistence.

CreateTemp2 overloads
# CreateTemp · 1/2
C#
public static FileAccess CreateTemp(FileAccess.ModeFlags modeFlags, string prefix = "", string extension = "", bool keep = false);

Creates a file in OS temp and returns an owned RefCounted handle in the requested mode. Native code first creates it with Write then reopens with that mode, so Read can open a new empty temp file. prefix/extension are filename parts, not paths. On null immediately check GetOpenError(). keep=false enables best-effort deletion of the original temp file on last native-reference release; Close() alone only closes the stream. keep=true preserves the file after release. C# using releases your reference, but other owners can extend lifetime. Cleanup after process failure is not guaranteed; lifecycle was source-reviewed only here.

Parameters
NameTypeDefault
modeFlagsFileAccess.ModeFlags—
prefixstring""
extensionstring""
keepboolfalse
modeFlags

Use only Read or Write for a container; for CreateTemp this is the returned handle mode.

prefix

Valid filename prefix without path separators; empty is allowed.

extension

Valid filename extension, not a directory. Native code removes one leading dot.

keep

True preserves the temp file after release; false enables best-effort deletion on last native-reference release.

Returns FileAccess

Owned temp handle or null; automatic cleanup depends on keep and native references.

# CreateTemp · 2/2
C#
public static FileAccess CreateTemp(int modeFlags, string prefix, string extension, bool keep);

Creates a file in OS temp and returns an owned RefCounted handle in the requested mode. Native code first creates it with Write then reopens with that mode, so Read can open a new empty temp file. prefix/extension are filename parts, not paths. On null immediately check GetOpenError(). keep=false enables best-effort deletion of the original temp file on last native-reference release; Close() alone only closes the stream. keep=true preserves the file after release. C# using releases your reference, but other owners can extend lifetime. Cleanup after process failure is not guaranteed; lifecycle was source-reviewed only here. The int overload forwards a numeric value as ModeFlags; use only values of that enum.

Parameters
NameTypeDefault
modeFlagsint—
prefixstring—
extensionstring—
keepbool—
modeFlags

Use only Read or Write for a container; for CreateTemp this is the returned handle mode.

prefix

Valid filename prefix without path separators; empty is allowed.

extension

Valid filename extension, not a directory. Native code removes one leading dot.

keep

True preserves the temp file after release; false enables best-effort deletion on last native-reference release.

Returns FileAccess

Owned temp handle or null; automatic cleanup depends on keep and native references.

EofReachedbool
# EofReached
C#
public bool EofReached();

Read-past-end indicator, not GetPosition() compared with GetLength(). An exact read of all available bytes leaves false on Windows; the next read attempt sets EOF. An empty line can be a valid blank file line. Use only on an open handle and check actual GetBuffer() length/read results.

Returns bool

Read-past-EOF indicator; a cursor exactly at end is insufficient.

FileExistsbool
# FileExists
C#
public static bool FileExists(string path);

Tests a file through the backend/packed data; a directory is not a file. False does not distinguish absence from inaccessibility; true guarantees no later Open() and does not replace ResourceLoader for imported resources. Check Open() itself rather than relying on this test alone.

Parameters
NameTypeDefault
pathstring—
path

File path to test; opening still requires checking its result.

Returns bool

True if the backend sees a file; false is also possible when inaccessible.

Flushvoid
# Flush
C#
public void Flush();

Flushes an open handle output buffer to its backend without closing it. Windows calls fflush and supplies no separate Error. Call before Resize() after buffered writes, otherwise a later flush can restore the old length; reproduced in testing. Not equivalent to System.IO.FileStream.Flush(true) and not a power-loss guarantee.

Get16ushort
# Get16
C#
public ushort Get16();

Reads an unsigned 16-bit number from 2 bytes at the current cursor. Byte order follows this handle BigEndian; defaults to little-endian. A short read supplies no separate bool and can return a partial value; zero is also valid data. Check record size and GetError(), not the numeric value alone.

Returns ushort

Unsigned 16-bit value; a short record may yield a partial value.

Get32uint
# Get32
C#
public uint Get32();

Reads an unsigned 32-bit number from 4 bytes at the current cursor. Byte order follows this handle BigEndian; defaults to little-endian. A short read supplies no separate bool and can return a partial value; zero is also valid data. Check record size and GetError(), not the numeric value alone.

Returns uint

Unsigned 32-bit value; a short record may yield a partial value.

Get64ulong
# Get64
C#
public ulong Get64();

Reads an unsigned 64-bit number from 8 bytes at the current cursor. Byte order follows this handle BigEndian; defaults to little-endian. A short read supplies no separate bool and can return a partial value; zero is also valid data. Check record size and GetError(), not the numeric value alone.

Returns ulong

Unsigned 64-bit value; a short record may yield a partial value.

Get8byte
# Get8
C#
public byte Get8();

Reads an unsigned 8-bit number from 1 bytes at the current cursor. BigEndian has no effect on one byte. A short read supplies no separate bool and can return a partial value; zero is also valid data. Check record size and GetError(), not the numeric value alone.

Returns byte

Unsigned 8-bit value; a short record may yield a partial value.

GetAccessTimeulong
# GetAccessTime
C#
public static ulong GetAccessTime(string file);

Access time in whole Unix-epoch seconds. Not a read counter or reliable last-gameplay-action signal: updates depend on OS/filesystem policy. Windows can fall back to creation time when access time is absent; errors can give 0 with a diagnostic. Do not infer accessibility/read permission from this timestamp alone.

Parameters
NameTypeDefault
filestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

Returns ulong

Unix seconds; not guaranteed to update on every read.

GetAsText2 overloads
# GetAsText · 1/2
C#
public string GetAsText();

Reads the entire file as UTF-8 from the beginning, then restores the original cursor. Does not read only the remainder. The main overload retains CR; it allocates for the whole content, so bound file size first. Not strict UTF-8/schema validation; for strict decoding read a bounded GetBuffer() and validate separately. Cursor restoration does not guarantee unchanged GetError().

Returns string

Entire-file UTF-8 text; empty alone does not prove success.

# GetAsText · 2/2
C#
public string GetAsText(bool skipCr);

Reads the entire file as UTF-8 from the beginning, then restores the original cursor. Does not read only the remainder. The main overload retains CR; it allocates for the whole content, so bound file size first. Not strict UTF-8/schema validation; for strict decoding read a bounded GetBuffer() and validate separately. Cursor restoration does not guarantee unchanged GetError().

Parameters
NameTypeDefault
skipCrbool—
skipCr

True removes all CR, including lone ones, not only CRLF. False retains CR.

Returns string

Entire-file UTF-8 text; empty alone does not prove success.

GetBufferbyte[]
# GetBuffer
C#
public byte[] GetBuffer(long length);

Reads up to length bytes from the current position into a new C# byte[]. At EOF the array can be shorter than requested; check Length for fixed-format data. 0 returns empty without reading; negative length is invalid. Bound allocations beforehand; empty alone does not distinguish a zero request, end or error.

Parameters
NameTypeDefault
lengthlong—
length

Requested byte count >= 0; bound allocation size beforehand.

Returns byte[]

New byte[] of actual bytes read, possibly shorter than length.

GetCsvLinestring[]
# GetCsvLine
C#
public string[] GetCsvLine(string delim = ",");

Reads a CSV record into string[]; quoted fields can span physical lines. Delimiter must be one non-double-quote character; double embedded quotes inside quoted fields. Line breaks are normalized through GetLine(). A blank line yields one empty field, not an unambiguous EOF signal. Does not validate schema/column count; damaged quotes can produce a diagnostic and a result, so validate records separately.

Parameters
NameTypeDefault
delimstring","
delim

One non-double-quote delimiter character for matched reading/writing; not a multicharacter string.

Returns string[]

Fields of one CSV record; a blank record normally has one empty field. Validate schema separately.

GetDoubledouble
# GetDouble
C#
public double GetDouble();

Reads Double from 8 bytes and returns C# double. BigEndian applies through the numeric layout. Does not enforce finite values or gameplay-domain bounds. Check format, remaining record size and I/O status separately; this does not parse a text number.

Returns double

C# double; the numeric value alone proves no complete successful read.

GetErrorError
# GetError
C#
public Error GetError();

Last backend status of this handle, not the last Open() error. Inspect immediately after an operation. On Windows a successful Seek() can clear the EOF indicator while GetError() retains FileEof; a later successful read refreshes it. Do not treat stale status as a new failure or ignore the current operation bool/returned length.

Returns Error

Last updated backend Error; may remain from an earlier operation.

GetExtendedAttributebyte[]
# GetExtendedAttribute
C#
public static byte[] GetExtendedAttribute(string file, string attributeName);

Reads named extended attribute/stream bytes through the backend; Windows uses an alternate data stream. Empty byte[] does not distinguish an empty value, absent name, failure or unsupported backend. The name list adds information but is not an atomic check. Raw data written by SetExtendedAttributeString() can include a trailing NUL.

Parameters
NameTypeDefault
filestring—
attributeNamestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

attributeName

Nonempty backend-format name; Windows uses a separate data-stream name. Not the main file path.

Returns byte[]

New value byte[]; empty is not an unambiguous diagnostic.

GetExtendedAttributeStringstring
# GetExtendedAttributeString
C#
public static string GetExtendedAttributeString(string file, string attributeName);

Gets named bytes and decodes UTF-8. Not strict text validation; empty cannot distinguish absence, empty data and failure. For exact formats use GetExtendedAttribute() with an explicit UTF-8/terminator policy. Do not treat the attribute as part of the main content returned by GetFileAsBytes().

Parameters
NameTypeDefault
filestring—
attributeNamestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

attributeName

Nonempty backend-format name; Windows uses a separate data-stream name. Not the main file path.

Returns string

Decoded string; empty is not an unambiguous diagnostic.

GetExtendedAttributesListstring[]
# GetExtendedAttributesList
C#
public static string[] GetExtendedAttributesList(string file);

Names of backend-visible extended attributes/streams. Windows lists named data streams, excluding the main unnamed stream. Order is unspecified. Empty can also result from unavailability/failure with no separate Error; the list can change before reading a value.

Parameters
NameTypeDefault
filestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

Returns string[]

Name string[] without sorting/atomicity guarantees.

GetFileAsBytesbyte[]
# GetFileAsBytes
C#
public static byte[] GetFileAsBytes(string path);

Opens a file, allocates for its full length and returns undecoded bytes. The bound helper updates GetOpenError(): empty can mean a valid empty file or an opening error, so check immediately. A convenience helper rather than a size-bounded reader: native code exposes no separate actual read count. For strict limits/short-read handling use Open(), GetLength() and bounded GetBuffer().

Parameters
NameTypeDefault
pathstring—
path

File path to read; size/accessibility can change after a separate check.

Returns byte[]

New byte[]; check GetOpenError() to distinguish an opening error for empty results.

GetFileAsStringstring
# GetFileAsString
C#
public static string GetFileAsString(string path);

Reads the whole file and decodes UTF-8, retaining CR. Empty can be valid data or an opening error; immediately check GetOpenError(), which this helper updates. That status describes opening, not full UTF-8/schema validation or concurrent file changes. Use bounded byte reads and a validating decoder for strict decoding.

Parameters
NameTypeDefault
pathstring—
path

File path to read; size/accessibility can change after a separate check.

Returns string

UTF-8 string; check GetOpenError() separately from decoding/schema validation.

GetFloatfloat
# GetFloat
C#
public float GetFloat();

Reads Float from 4 bytes and returns C# float. BigEndian applies through the numeric layout. Does not enforce finite values or gameplay-domain bounds. Check format, remaining record size and I/O status separately; this does not parse a text number.

Returns float

C# float; the numeric value alone proves no complete successful read.

GetHalffloat
# GetHalf
C#
public float GetHalf();

Reads Half from 2 bytes and returns C# float. BigEndian applies through the numeric layout. Half loses source float precision: storage is 16-bit, not 32-bit. Check format, remaining record size and I/O status separately; this does not parse a text number.

Returns float

C# float; the numeric value alone proves no complete successful read.

GetHiddenAttributebool
# GetHiddenAttribute
C#
public static bool GetHiddenAttribute(string file);

Queries a path hidden attribute through the backend; Windows reads FILE_ATTRIBUTE_HIDDEN. Not a universal dot-prefixed-name rule or access control. False can result from an error with a diagnostic rather than proving a normal file. Packed entries may provide no attribute.

Parameters
NameTypeDefault
filestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

Returns bool

Backend hidden flag; false does not certify successful attribute querying.

GetLengthulong
# GetLength
C#
public ulong GetLength();

Open file length in bytes, not remaining bytes or character count. Check a size limit before allocating buffers, while allowing for later changes. Windows temporarily seeks to end and back; EOF state can change, so this is not a substitute for checking read results.

Returns ulong

Open file byte length.

GetLinestring
# GetLine
C#
public string GetLine();

Reads the next UTF-8 line from the current cursor without its terminator. Handles LF, CRLF and lone CR; NUL also ends a line, so this is unsuitable for arbitrary binary data. Empty does not necessarily mean EOF; an unterminated final line is also returned. Bound file size for input constraints.

Returns string

Line without its terminator; empty is also possible before EOF.

GetMd5string
# GetMd5
C#
public static string GetMd5(string path);

Reads the main file stream and returns MD5 as 32 lowercase hex characters. A valid empty file has a nonempty digest; opening failure gives empty string. A hash, not a digital signature or source-trust check. Native helper supplies no separate complete-read status; post-partial-read I/O errors and concurrent changes were not tested here.

Parameters
NameTypeDefault
pathstring—
path

File path to read; size/accessibility can change after a separate check.

Returns string

32 lowercase hex characters or empty on opening failure.

GetModifiedTimeulong
# GetModifiedTime
C#
public static ulong GetModifiedTime(string file);

Modification time in whole Unix-epoch seconds, not milliseconds or local time. Windows can fall back to creation time when write time is absent; failure/unavailability can return 0. Precision and updates depend on the backend. A timestamp alone does not verify content; packed/export metadata was not exercised here.

Parameters
NameTypeDefault
filestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

Returns ulong

Unix seconds; 0 is also possible for unavailable results.

GetOpenErrorError
# GetOpenError
C#
public static Error GetOpenError();

Last public file-opening error on this thread. A later Open-family call can replace it even on success. Read immediately after null; for an already opened handle, inspect operation results and GetError() instead of this static getter.

Returns Error

Last opening status on this thread; not current handle-operation status.

GetPascalStringstring
# GetPascalString
C#
public string GetPascalString();

Reads a 32-bit length then UTF-8 payload, not an LF/NUL-terminated line. Length is bytes and uses BigEndian. Native code allocates from the prefix: validate a length bound and payload availability before using this on external data. Returned text is not strict corrupted-record validation; invalid/huge lengths were not executed in this pass.

Returns string

Decoded string; the result alone does not validate framing/length.

GetPathstring
# GetPath
C#
public string GetPath();

Path associated with the open handle; Windows returns the original Open() string, such as asset://. Not necessarily a normalized OS path or persistent ID. Use GetPathAbsolute() for a physical path, subject to backend/export limits.

Returns string

Original/backend path associated with the handle.

GetPathAbsolutestring
# GetPathAbsolute
C#
public string GetPathAbsolute();

Absolute path representation when supplied by the backend. Windows removes its internal prefix and uses forward separators. Does not prove existence, write permission, availability outside the application or a loose file in an exported package.

Returns string

Backend absolute representation; not a universal physical path for every export.

GetPositionulong
# GetPosition
C#
public ulong GetPosition();

Current byte position in an open file. A UTF-8 character can span several bytes, so this is not a character count. Interpret alongside the data format and read result. Position at file end alone does not imply EofReached().

Returns ulong

Current byte offset, not a character index.

GetReadOnlyAttributebool
# GetReadOnlyAttribute
C#
public static bool GetReadOnlyAttribute(string file);

Reads the backend read-only attribute, FILE_ATTRIBUTE_READONLY on Windows. Not a full ACL test or guarantee about Open(Write)/another process access. Query errors can also return false with a diagnostic; check actual write operations separately.

Parameters
NameTypeDefault
filestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

Returns bool

Backend read-only flag; not the full access-permission model.

GetRealfloat
# GetReal
C#
public float GetReal();

Reads native real according to the internal read mode; the current SDK returns C# float and the installed build read 4 bytes. Not universal precision negotiation between builds. For a stable external format explicitly choose GetFloat() or GetDouble() and fix width, byte order and record version.

Returns float

Current SDK C# float; native format width must be agreed separately.

GetSha256string
# GetSha256
C#
public static string GetSha256(string path);

Reads the main file stream and returns SHA-256 as 64 lowercase hex characters. A valid empty file has a nonempty digest; opening failure gives empty string. A hash, not a digital signature or source-trust check. Native helper supplies no separate complete-read status; post-partial-read I/O errors and concurrent changes were not tested here.

Parameters
NameTypeDefault
pathstring—
path

File path to read; size/accessibility can change after a separate check.

Returns string

64 lowercase hex characters or empty on opening failure.

GetSizelong
# GetSize
C#
public static long GetSize(string file);

File byte size by path without a public handle. Ordinary backend failures can return -1, but this is not a universal indicator: Windows returns 0 for some invalid paths. Zero therefore proves no existing empty file. Check Open() for subsequent I/O; size can change after querying.

Parameters
NameTypeDefault
filestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

Returns long

Byte size or a backend sentinel; -1/0 semantics vary by path/backend.

GetUnixPermissionsFileAccess.UnixPermissionFlags
# GetUnixPermissions
C#
public static FileAccess.UnixPermissionFlags GetUnixPermissions(string file);

Returns Unix permission bits where supplied by the backend, not a full ACL. Windows returns 0 even for accessible files; this does not mean all access is denied. Packed entries can also give 0. Determine support and actual opening access separately.

Parameters
NameTypeDefault
filestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

Returns FileAccess.UnixPermissionFlags

Permission bitmask; 0 also represents unavailable support on Windows.

GetVarVariant
# GetVar
C#
public Variant GetVar(bool allowObjects = false);

Reads a StoreVar record: a 32-bit length using current BigEndian and a native Variant payload. Scope the C# result with using Variant. Nil may be valid stored data and can also result from an error; it is insufficient as a success test. Bound framing beforehand and validate schema/types. Keep allowObjects=false for external data; true permits native object construction from data, not merely extra fields. Full objects and corrupted lengths were not executed here.

Parameters
NameTypeDefault
allowObjectsboolfalse
allowObjects

Defaults to false. Enable true only for trusted object formats, accounting for possible class construction from payload.

Returns Variant

Record Variant; Nil can also be valid data. Release the owned result with using.

IsBigEndianbool
# IsBigEndian
C#
public bool IsBigEndian();

Byte-order setting for numeric Get/Store operations on this handle: false is little-endian, true big-endian. A new Open() has a fresh false-default handle; the setting is not stored as file metadata. Does not reorder GetBuffer/StoreBuffer bytes or UTF-8 text. StoreVar/GetVar applies it to the 32-bit length prefix, not the inner Variant payload; tested. Reader and writer must agree on the format.

Returns bool

Current BigEndian setting of this handle.

IsOpenbool
# IsOpen
C#
public bool IsOpen();

Tests whether a live handle has an open file. Returns false after Close() on the tested Windows backend. Proves no write mode, free space, current contents or previous-operation success. Do not use a wrapper after Dispose even for this test.

Returns bool

True when the live handle has an open file.

OpenFileAccess
# Open
C#
public static FileAccess Open(string path, FileAccess.ModeFlags flags);

Opens a file and returns an owned RefCounted handle; use using in C#. On null read GetOpenError() immediately on the same thread. Read/ReadWrite require an existing file; Write/WriteRead create or truncate it. ReadWrite preserves contents and starts at position 0, not append mode. Creates no parents. Use user:// for progress; original files under asset:// are not guaranteed after export.

Parameters
NameTypeDefault
pathstring—
flagsFileAccess.ModeFlags—
path

File path: user://, asset:// or a supported OS path; the parent must exist.

flags

Read/ReadWrite for an existing file; Write/WriteRead create or truncate. Do not confuse ReadWrite and WriteRead.

Returns FileAccess

Owned FileAccess or null; read GetOpenError() immediately.

OpenCompressedFileAccess
# OpenCompressed
C#
public static FileAccess OpenCompressed(string path, FileAccess.ModeFlags modeFlags, FileAccess.CompressionMode compressionMode = FileAccess.CompressionMode.Fastlz);

Opens a FileAccess compression container, not an arbitrary .zip/.gz file. Even CompressionMode.GZip selects an algorithm inside the engine GCPF container. Use Write for writing and Read for reading; ReadWrite is rejected and WriteRead is not supported editing of an existing container. Reads select the algorithm from the header. Writes stay buffered until Close()/release; Flush() does not finalize them. The returned handle is owned; on null immediately check GetOpenError(). Corrupt/foreign containers are not validated inputs here.

Parameters
NameTypeDefault
pathstring—
modeFlagsFileAccess.ModeFlags—
compressionModeFileAccess.CompressionModeFileAccess.CompressionMode.Fastlz
path

Container file path; Write can lose existing contents before setup finishes.

modeFlags

Use only Read or Write for a container; for CreateTemp this is the returned handle mode.

compressionMode

Write algorithm inside GCPF; reads select it from the header. The selected algorithm must support encoding; Brotli is read-only.

Returns FileAccess

Owned FileAccess or null; immediately GetOpenError() on null.

OpenEncrypted4 overloads
# OpenEncrypted · 1/4
C#
public static FileAccess OpenEncrypted(string path, FileAccess.ModeFlags modeFlags, byte[] key);

Opens an engine encrypted FileAccess container with a 32-byte key; use only Read or Write. Critical 1.0.0 limitation: the base Write opens/truncates the destination before key validation. An invalid key length can return null/Error.InvalidParameter after previous contents are lost; reproduced on a disposable file. Validate parameters before calling and avoid overwriting the only valuable copy. Data stays in memory until Close()/release; Flush() writes no finished container. A write IV must be empty for generation or 16 bytes; reads use the file IV. The format uses AES-CFB and a data MD5, not a separately validated authenticated-encryption protocol. Security assessment and wrong-key reads were not executed; roundtrip does not prove security. On null check GetOpenError() immediately. The overload without iV selects automatic IV generation on writes.

Parameters
NameTypeDefault
pathstring—
modeFlagsFileAccess.ModeFlags—
keybyte[]—
path

Container file path; Write can lose existing contents before setup finishes.

modeFlags

Use only Read or Write for a container; for CreateTemp this is the returned handle mode.

key

Exactly 32 key bytes. Validate length before Write opening: native validation occurs after base-file opening. Array/span is not a text password.

Returns FileAccess

Owned FileAccess or null; a Write failure does not imply preservation of an existing file.

# OpenEncrypted · 2/4
C#
public static FileAccess OpenEncrypted(string path, FileAccess.ModeFlags modeFlags, byte[] key, byte[] iV = null);

Opens an engine encrypted FileAccess container with a 32-byte key; use only Read or Write. Critical 1.0.0 limitation: the base Write opens/truncates the destination before key validation. An invalid key length can return null/Error.InvalidParameter after previous contents are lost; reproduced on a disposable file. Validate parameters before calling and avoid overwriting the only valuable copy. Data stays in memory until Close()/release; Flush() writes no finished container. A write IV must be empty for generation or 16 bytes; reads use the file IV. The format uses AES-CFB and a data MD5, not a separately validated authenticated-encryption protocol. Security assessment and wrong-key reads were not executed; roundtrip does not prove security. On null check GetOpenError() immediately.

Parameters
NameTypeDefault
pathstring—
modeFlagsFileAccess.ModeFlags—
keybyte[]—
iVbyte[]null
path

Container file path; Write can lose existing contents before setup finishes.

modeFlags

Use only Read or Write for a container; for CreateTemp this is the returned handle mode.

key

Exactly 32 key bytes. Validate length before Write opening: native validation occurs after base-file opening. Array/span is not a text password.

iV

Empty on writing enables IV generation; nonempty must contain 16 bytes. Reads use the header IV. Do not carry a fixed QA IV into a production scheme.

Returns FileAccess

Owned FileAccess or null; a Write failure does not imply preservation of an existing file.

# OpenEncrypted · 3/4
C#
public static FileAccess OpenEncrypted(string path, FileAccess.ModeFlags modeFlags, ReadOnlySpan<byte> key);

Opens an engine encrypted FileAccess container with a 32-byte key; use only Read or Write. Critical 1.0.0 limitation: the base Write opens/truncates the destination before key validation. An invalid key length can return null/Error.InvalidParameter after previous contents are lost; reproduced on a disposable file. Validate parameters before calling and avoid overwriting the only valuable copy. Data stays in memory until Close()/release; Flush() writes no finished container. A write IV must be empty for generation or 16 bytes; reads use the file IV. The format uses AES-CFB and a data MD5, not a separately validated authenticated-encryption protocol. Security assessment and wrong-key reads were not executed; roundtrip does not prove security. On null check GetOpenError() immediately. The overload without iV selects automatic IV generation on writes.

Parameters
NameTypeDefault
pathstring—
modeFlagsFileAccess.ModeFlags—
keyReadOnlySpan<byte>—
path

Container file path; Write can lose existing contents before setup finishes.

modeFlags

Use only Read or Write for a container; for CreateTemp this is the returned handle mode.

key

Exactly 32 key bytes. Validate length before Write opening: native validation occurs after base-file opening. Array/span is not a text password.

Returns FileAccess

Owned FileAccess or null; a Write failure does not imply preservation of an existing file.

# OpenEncrypted · 4/4
C#
public static FileAccess OpenEncrypted(string path, FileAccess.ModeFlags modeFlags, ReadOnlySpan<byte> key, ReadOnlySpan<byte> iV);

Opens an engine encrypted FileAccess container with a 32-byte key; use only Read or Write. Critical 1.0.0 limitation: the base Write opens/truncates the destination before key validation. An invalid key length can return null/Error.InvalidParameter after previous contents are lost; reproduced on a disposable file. Validate parameters before calling and avoid overwriting the only valuable copy. Data stays in memory until Close()/release; Flush() writes no finished container. A write IV must be empty for generation or 16 bytes; reads use the file IV. The format uses AES-CFB and a data MD5, not a separately validated authenticated-encryption protocol. Security assessment and wrong-key reads were not executed; roundtrip does not prove security. On null check GetOpenError() immediately.

Parameters
NameTypeDefault
pathstring—
modeFlagsFileAccess.ModeFlags—
keyReadOnlySpan<byte>—
iVReadOnlySpan<byte>—
path

Container file path; Write can lose existing contents before setup finishes.

modeFlags

Use only Read or Write for a container; for CreateTemp this is the returned handle mode.

key

Exactly 32 key bytes. Validate length before Write opening: native validation occurs after base-file opening. Array/span is not a text password.

iV

Empty on writing enables IV generation; nonempty must contain 16 bytes. Reads use the header IV. Do not carry a fixed QA IV into a production scheme.

Returns FileAccess

Owned FileAccess or null; a Write failure does not imply preservation of an existing file.

OpenEncryptedWithPassFileAccess
# OpenEncryptedWithPass
C#
public static FileAccess OpenEncryptedWithPass(string path, FileAccess.ModeFlags modeFlags, string pass);

Opens the same encrypted FileAccess container using a password. Current native code derives the key from 32 characters of password MD5 text; this promises no modern password KDF, salt or separate authentication. Use Read/Write; check null and immediately GetOpenError(). Writes finalize only on close; Flush() leaves data in memory. The base Write already changes an existing file before setup completes, so container-opening failure does not guarantee destination preservation. A successful password roundtrip was tested; no security assessment was performed.

Parameters
NameTypeDefault
pathstring—
modeFlagsFileAccess.ModeFlags—
passstring—
path

Container file path; Write can lose existing contents before setup finishes.

modeFlags

Use only Read or Write for a container; for CreateTemp this is the returned handle mode.

pass

Password for the current native format, not raw 32 key bytes. Keep real secrets out of published examples.

Returns FileAccess

Owned FileAccess or null; check GetOpenError() while accounting for early Write-destination changes.

RemoveExtendedAttributeError
# RemoveExtendedAttribute
C#
public static Error RemoveExtendedAttribute(string file, string attributeName);

Removes one named value/stream, not the file or all attributes. A missing name returns an error on Windows; do not assume automatic idempotence. Check Error/backend support; remove empty values by name like nonempty ones.

Parameters
NameTypeDefault
filestring—
attributeNamestring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

attributeName

Nonempty backend-format name; Windows uses a separate data-stream name. Not the main file path.

Returns Error

Backend operation Error; distinguish Ok, Unavailable and other failures.

ResizeError
# Resize
C#
public Error Resize(long length);

Changes a writable open file byte length. Flush() first after writes: on Windows pending output can restore the old length even after Resize() returns Ok; reproduced. Check Error and final length; explicitly set the next operation cursor. Zero-filled growth was tested only on the current Windows filesystem, not guaranteed for every backend.

Parameters
NameTypeDefault
lengthlong—
length

New nonnegative byte length; flush pending output first.

Returns Error

Length-change Error; with pending writes Ok alone does not prove final length.

Seekvoid
# Seek
C#
public void Seek(ulong position);

Sets an absolute byte offset from the beginning of an open file. Not a character index or truncation; a short overwrite can leave the old tail. Returns no Error; validate the offset and inspect subsequent I/O results. Windows successful seek clears the EOF indicator but may leave the previous GetError().

Parameters
NameTypeDefault
positionulong—
position

Nonnegative absolute byte offset from the open file beginning.

SeekEndvoid
# SeekEnd
C#
public void SeekEnd(long position = 0);

Moves relative to file end in bytes. 0 selects end for appending; negative values move before end; do not seek before the beginning. Creates no file and changes no mode. Call SeekEnd() to append after ReadWrite rather than assuming its initial cursor is at the end.

Parameters
NameTypeDefault
positionlong0
position

Byte offset from end; 0 for end, negative for an earlier position.

SetBigEndianvoid
# SetBigEndian
C#
public void SetBigEndian(bool bigEndian);

Byte-order setting for numeric Get/Store operations on this handle: false is little-endian, true big-endian. A new Open() has a fresh false-default handle; the setting is not stored as file metadata. Does not reorder GetBuffer/StoreBuffer bytes or UTF-8 text. StoreVar/GetVar applies it to the 32-bit length prefix, not the inner Variant payload; tested. Reader and writer must agree on the format.

Parameters
NameTypeDefault
bigEndianbool—
bigEndian

True for big-endian numeric fields; false for little-endian. Does not detect the format automatically.

SetExtendedAttribute2 overloads
# SetExtendedAttribute · 1/2
C#
public static Error SetExtendedAttribute(string file, string attributeName, byte[] data);

Writes named bytes through the backend; array/span overloads supply the same content. Windows creates/overwrites a separate data stream, not the file main bytes. Check Error and filesystem support. An empty array can create an existing name with an empty value; it is not removal—use RemoveExtendedAttribute().

Parameters
NameTypeDefault
filestring—
attributeNamestring—
databyte[]—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

attributeName

Nonempty backend-format name; Windows uses a separate data-stream name. Not the main file path.

data

Named-value bytes; an empty buffer does not mean removal.

Returns Error

Backend operation Error; distinguish Ok, Unavailable and other failures.

# SetExtendedAttribute · 2/2
C#
public static Error SetExtendedAttribute(string file, string attributeName, ReadOnlySpan<byte> data);

Writes named bytes through the backend; array/span overloads supply the same content. Windows creates/overwrites a separate data stream, not the file main bytes. Check Error and filesystem support. An empty array can create an existing name with an empty value; it is not removal—use RemoveExtendedAttribute().

Parameters
NameTypeDefault
filestring—
attributeNamestring—
dataReadOnlySpan<byte>—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

attributeName

Nonempty backend-format name; Windows uses a separate data-stream name. Not the main file path.

data

Named-value bytes; an empty buffer does not mean removal.

Returns Error

Backend operation Error; distinguish Ok, Unavailable and other failures.

SetExtendedAttributeStringError
# SetExtendedAttributeString
C#
public static Error SetExtendedAttributeString(string file, string attributeName, string data);

Encodes UTF-8 text for the attribute backend. The current implementation includes a trailing NUL, confirmed by reading raw bytes on Windows. For exact external byte formats use SetExtendedAttribute() with explicit encoding/terminator rules. Check Error; this does not write the main file content.

Parameters
NameTypeDefault
filestring—
attributeNamestring—
datastring—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

attributeName

Nonempty backend-format name; Windows uses a separate data-stream name. Not the main file path.

data

String to encode as UTF-8; current implementation appends NUL to raw bytes.

Returns Error

Backend operation Error; distinguish Ok, Unavailable and other failures.

SetHiddenAttributeError
# SetHiddenAttribute
C#
public static Error SetHiddenAttribute(string file, bool hidden);

Changes the backend hidden attribute; check returned Error. Windows changes the corresponding bit while retaining other attributes. Creates no file and protects no content from reading. OS/filesystem/packed-resource support varies; unavailable/failure is not successful application.

Parameters
NameTypeDefault
filestring—
hiddenbool—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

hidden

True sets hidden, false clears it; not access control.

Returns Error

Backend operation Error; distinguish Ok, Unavailable and other failures.

SetReadOnlyAttributeError
# SetReadOnlyAttribute
C#
public static Error SetReadOnlyAttribute(string file, bool ro);

Sets/clears the backend read-only attribute; Windows changes one bit while retaining others. Not equivalent to configuring all permissions/ACLs and does not guarantee reversal if environment permissions change. Check Error; packed entries may not support this operation.

Parameters
NameTypeDefault
filestring—
robool—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

ro

True sets the read-only attribute, false clears it; not ACL configuration.

Returns Error

Backend operation Error; distinguish Ok, Unavailable and other failures.

SetUnixPermissionsError
# SetUnixPermissions
C#
public static Error SetUnixPermissions(string file, FileAccess.UnixPermissionFlags permissions);

Requests Unix permission-bit changes. The tested Windows backend returns Error.Unavailable without changing ACLs. Packed entries are also unavailable for setting. Check Error; success of another attribute API proves no chmod support. Unix platforms were not executed here.

Parameters
NameTypeDefault
filestring—
permissionsFileAccess.UnixPermissionFlags—
file

Specific file/object path; asset://, user:// or a supported OS path subject to backend support.

permissions

Unix permission bits; the Windows backend returns Unavailable here.

Returns Error

Backend operation Error; distinguish Ok, Unavailable and other failures.

Store16bool
# Store16
C#
public bool Store16(ushort value);

Writes an unsigned 16-bit number in exactly 2 bytes at the current cursor, without a type/length tag. Byte order follows this handle BigEndian; defaults to little-endian. The reader must know the format and use Get16(). Check bool; writing is not atomic and guarantees no media flush.

Parameters
NameTypeDefault
valueushort—
value

Unsigned 16-bit value. Validate range before explicitly converting a wider/signed type.

Returns bool

Bool result for writing all numeric bytes; not durable-storage assurance.

Store32bool
# Store32
C#
public bool Store32(uint value);

Writes an unsigned 32-bit number in exactly 4 bytes at the current cursor, without a type/length tag. Byte order follows this handle BigEndian; defaults to little-endian. The reader must know the format and use Get32(). Check bool; writing is not atomic and guarantees no media flush.

Parameters
NameTypeDefault
valueuint—
value

Unsigned 32-bit value. Validate range before explicitly converting a wider/signed type.

Returns bool

Bool result for writing all numeric bytes; not durable-storage assurance.

Store64bool
# Store64
C#
public bool Store64(ulong value);

Writes an unsigned 64-bit number in exactly 8 bytes at the current cursor, without a type/length tag. Byte order follows this handle BigEndian; defaults to little-endian. The reader must know the format and use Get64(). Check bool; writing is not atomic and guarantees no media flush.

Parameters
NameTypeDefault
valueulong—
value

Unsigned 64-bit value. Validate range before explicitly converting a wider/signed type.

Returns bool

Bool result for writing all numeric bytes; not durable-storage assurance.

Store8bool
# Store8
C#
public bool Store8(byte value);

Writes an unsigned 8-bit number in exactly 1 bytes at the current cursor, without a type/length tag. BigEndian has no effect on one byte. The reader must know the format and use Get8(). Check bool; writing is not atomic and guarantees no media flush.

Parameters
NameTypeDefault
valuebyte—
value

Unsigned 8-bit value. Validate range before explicitly converting a wider/signed type.

Returns bool

Bool result for writing all numeric bytes; not durable-storage assurance.

StoreBuffer2 overloads
# StoreBuffer · 1/2
C#
public bool StoreBuffer(byte[] buffer);

Writes supplied bytes at the current cursor without text, size or byte-order conversion. Array/span overloads perform the same write. Creates no parents, truncates no remaining old tail and promises no atomicity. Check bool/status and use a suitable ReadWrite/WriteRead mode when writing after reading.

Parameters
NameTypeDefault
bufferbyte[]—
buffer

Bytes to write from the current cursor; the buffer is not automatically an object serialization.

Returns bool

Backend bool result for writing all supplied bytes.

# StoreBuffer · 2/2
C#
public bool StoreBuffer(ReadOnlySpan<byte> buffer);

Writes supplied bytes at the current cursor without text, size or byte-order conversion. Array/span overloads perform the same write. Creates no parents, truncates no remaining old tail and promises no atomicity. Check bool/status and use a suitable ReadWrite/WriteRead mode when writing after reading.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
buffer

Bytes to write from the current cursor; the buffer is not automatically an object serialization.

Returns bool

Backend bool result for writing all supplied bytes.

StoreCsvLine2 overloads
# StoreCsvLine · 1/2
C#
public bool StoreCsvLine(ReadOnlySpan<string> values, string delim);

Writes a CSV record and one LF. Fields containing a delimiter, quote or LF are quoted; embedded quotes are doubled. A lone CR does not trigger quoting in the current implementation: such a field can split into two records when read, as reproduced. Normalize CRLF/CR to LF first when line breaks are needed inside fields; this changes original line endings. Use one non-double-quote delimiter for matching GetCsvLine(). Array/span overloads use the same format; check bool.

Parameters
NameTypeDefault
valuesReadOnlySpan<string>—
delimstring—
values

Record fields; normalize CRLF/CR according to your text policy first, otherwise lone CR can break roundtrip.

delim

One non-double-quote delimiter character for matched reading/writing; not a multicharacter string.

Returns bool

Bool result of writing the formatted line and LF; does not certify exact lone-CR roundtrip.

# StoreCsvLine · 2/2
C#
public bool StoreCsvLine(string[] values, string delim = ",");

Writes a CSV record and one LF. Fields containing a delimiter, quote or LF are quoted; embedded quotes are doubled. A lone CR does not trigger quoting in the current implementation: such a field can split into two records when read, as reproduced. Normalize CRLF/CR to LF first when line breaks are needed inside fields; this changes original line endings. Use one non-double-quote delimiter for matching GetCsvLine(). Array/span overloads use the same format; check bool.

Parameters
NameTypeDefault
valuesstring[]—
delimstring","
values

Record fields; normalize CRLF/CR according to your text policy first, otherwise lone CR can break roundtrip.

delim

One non-double-quote delimiter character for matched reading/writing; not a multicharacter string.

Returns bool

Bool result of writing the formatted line and LF; does not certify exact lone-CR roundtrip.

StoreDoublebool
# StoreDouble
C#
public bool StoreDouble(double value);

Encodes a number as Double in 8 bytes with selected BigEndian; no text representation or type tag. Does not enforce finite values or gameplay-domain bounds. Read with matching GetDouble() and format; check the write bool.

Parameters
NameTypeDefault
valuedouble—
value

Number for the selected binary precision; the caller validates application-domain constraints.

Returns bool

Backend encoding/write result bool.

StoreFloatbool
# StoreFloat
C#
public bool StoreFloat(float value);

Encodes a number as Float in 4 bytes with selected BigEndian; no text representation or type tag. Does not enforce finite values or gameplay-domain bounds. Read with matching GetFloat() and format; check the write bool.

Parameters
NameTypeDefault
valuefloat—
value

Number for the selected binary precision; the caller validates application-domain constraints.

Returns bool

Backend encoding/write result bool.

StoreHalfbool
# StoreHalf
C#
public bool StoreHalf(float value);

Encodes a number as Half in 2 bytes with selected BigEndian; no text representation or type tag. Half loses source float precision: storage is 16-bit, not 32-bit. Read with matching GetHalf() and format; check the write bool.

Parameters
NameTypeDefault
valuefloat—
value

Number for the selected binary precision; the caller validates application-domain constraints.

Returns bool

Backend encoding/write result bool.

StoreLinebool
# StoreLine
C#
public bool StoreLine(string line);

Writes UTF-8 text followed by one LF byte (0x0A), not platform CRLF. Does not remove a terminator already present in the argument. Returns the combined bool result; position grows by UTF-8 byte count plus LF. Overwrite and persistence limits are the same as StoreString().

Parameters
NameTypeDefault
linestring—
line

Line text; the method additionally writes one LF.

Returns bool

True when both string and appended LF writes succeed at backend level.

StorePascalStringbool
# StorePascalString
C#
public bool StorePascalString(string @string);

Writes a 32-bit UTF-8 byte length followed by the string bytes. Not a one-byte Pascal length or C# character count. The prefix uses BigEndian; payload remains UTF-8. Read with GetPascalString(), matching byte order and an agreed record-size bound; check bool.

Parameters
NameTypeDefault
stringstring—
string

Text to encode as UTF-8; the prefix contains encoded byte length, not string.Length.

Returns bool

Combined bool result of writing length and UTF-8 bytes.

StoreRealbool
# StoreReal
C#
public bool StoreReal(float value);

Native real write width depends on build precision: source selects StoreFloat or StoreDouble by sizeof(real_t). The installed build used 4 bytes; other precision builds were not tested. Explicitly choose StoreFloat()/StoreDouble() for a fixed-width external format. BigEndian applies; bool does not certify media persistence.

Parameters
NameTypeDefault
valuefloat—
value

Number in the current SDK real type; not an automatically portable-precision field.

Returns bool

Bool result of this build native real write.

StoreStringbool
# StoreString
C#
public bool StoreString(string @string);

Writes UTF-8 bytes at the current cursor without an automatic LF or length prefix. Position is measured in bytes. A short overwrite does not truncate an old tail; choose Write/WriteRead or controlled Resize(). Check bool and GetError(); true guarantees neither media persistence nor atomic saving.

Parameters
NameTypeDefault
stringstring—
string

Text to encode as UTF-8 without an automatic line terminator.

Returns bool

Write result bool; not durable-storage assurance.

StoreVarbool
# StoreVar
C#
public bool StoreVar(Variant value, bool fullObjects = false);

Serializes a Variant into native binary payload with a 32-bit length prefix. Format belongs to StoreVar/GetVar, not JSON, a prefab or a whole-level snapshot. BigEndian changes the length prefix, not inner payload bytes. fullObjects defaults to false; full-object serialization was not executed. Takes no ownership of the input Variant. Add your own save version/schema; check write bool and loaded types.

Parameters
NameTypeDefault
valueVariant—
fullObjectsboolfalse
value

Variant to write; ownership remains with the caller. Game-object references do not automatically become persistent IDs.

fullObjects

Defaults to false. True enables full object representation, not automatic level saving; this mode was not tested here.

Returns bool

Bool result for length and Variant payload writes; not atomic-save or schema-compatibility assurance.

FileAccess.CompressionMode

ValueDescription
Brotli = 4

Uses the brotli compression method (only decompression is supported).

Deflate = 1

Uses the DEFLATE(https://en.wikipedia.org/wiki/DEFLATE) compression method.

Fastlz = 0

Uses the FastLZ(https://fastlz.org/) compression method.

GZip = 3

Uses the gzip compression method.

Zstd = 2

Uses the Zstandard(https://facebook.github.io/zstd/) compression method.

FileAccess.ModeFlags

ValueDescription
Read = 1

Opens the file for read operations. The file cursor is positioned at the beginning of the file.

ReadWrite = 3

Opens the file for read and write operations. Does not truncate the file. The file cursor is positioned at the beginning of the file.

Write = 2

Opens the file for write operations. If the file exists, it is truncated to zero length and its contents are cleared. Otherwise, it is created. Note: When creating a file it must be in an already existing directory. To recursively create directories for a file path, see DirAccess.MakeDirRecursive.

WriteRead = 7

Opens the file for read and write operations. If the file exists, it is truncated to zero length and its contents are cleared. Otherwise, it is created. The file cursor is positioned at the beginning of the file. Note: When creating a file it must be in an already existing directory. To recursively create directories for a file path, see DirAccess.MakeDirRecursive.

FileAccess.UnixPermissionFlags

ValueDescription
ExecuteGroup = 8

Execute for group bit.

ExecuteOther = 1

Execute for other bit.

ExecuteOwner = 64

Execute for owner bit.

ReadGroup = 32

Read for group bit.

ReadOther = 4

Read for other bit.

ReadOwner = 256

Read for owner bit.

RestrictedDelete = 512

Restricted deletion (sticky) bit.

SetGroupId = 1024

Set group id on execution bit.

SetUserId = 2048

Set user id on execution bit.

WriteGroup = 16

Write for group bit.

WriteOther = 2

Write for other bit.

WriteOwner = 128

Write for owner bit.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.