API Reference
OfficeImageFileWriter
Saves already encoded image bytes through a same-directory atomic file commit.
Inheritance
- Object
- OfficeImageFileWriter
Remarks
The supplied bytes are borrowed and are not modified, cloned, parsed, or format-validated. Keep them unchanged until the operation completes. An existing destination is overwritten only after staging succeeds. Unsupported atomic replacement fails without a non-atomic fallback. File-system failures propagate; failed staging is cleaned up when the file system permits it. Cancellation is observed while staging and immediately before commit. Once replacement begins, it can complete even if cancellation is requested. This API does not promise power-loss durability.
Methods
public static Void WriteAllBytes(String path, Byte[] encodedImage, CancellationToken cancellationToken = default) #VoidStages encoded bytes and atomically creates or replaces the destination file.
Parameters
- path System.String
- The destination file path. Missing parent directories are created.
- encodedImage System.Byte[]
- Already encoded bytes, borrowed until the method returns.
- cancellationToken System.Threading.CancellationToken = default
- Cancels staging and prevents publication when observed before commit.
Exceptions
ArgumentNullException– The supplied byte array is null.
public static Task WriteAllBytesAsync(String path, Byte[] encodedImage, CancellationToken cancellationToken = default) #TaskAsynchronously stages encoded bytes and atomically creates or replaces the destination file.
Parameters
- path System.String
- The destination file path. Missing parent directories are created.
- encodedImage System.Byte[]
- Already encoded bytes, borrowed until the returned task completes.
- cancellationToken System.Threading.CancellationToken = default
- Cancels staging and prevents publication when observed before commit.
Exceptions
ArgumentNullException– The supplied byte array is null.