Show / Hide Table of Contents

Interface ITempFileProvider

Interface defining a provider that offers services for reading and writing temporary files.

Namespace: SuperOffice.IO
Assembly: SoCore.dll
Syntax
public interface ITempFileProvider
Remarks

Temporary files are used in several contexts - when transferring documents in chunks into and out of NetServer; when uploading a document to be saved through the Document dialog, and when handling mails and attachments.

The implementation supplied with NetServer provides these services using temporary files, controlled by the Documents section in the config file with respect to path and impersonation.

Methods

CheckIfFileExistsAsync(string, CancellationToken)

Check if a named temporary file/storage area exists

Declaration
Task<bool> CheckIfFileExistsAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

File name to check

CancellationToken cancellationToken
Returns
Type Description
Task<bool>

True if such a file exists

Remarks

Temporary files are used in several contexts - when transferring documents in chunks into and out of NetServer; when uploading a document to be saved through the Document dialog, and when handling mails and attachments.

The implementation supplied with NetServer provides these services using temporary files, controlled by the Documents section in the config file with respect to path and impersonation.

CreateFileAsync(string, CancellationToken)

Create a temporary 'file'

Declaration
Task<string> CreateFileAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

Name to be used for later access. The actual key used by the implementation should also take into account the associate ID, since multiple concurrent users may use the same name, and that does not mean file sharing between users.

CancellationToken cancellationToken
Returns
Type Description
Task<string>
Remarks

Temporary files are used in several contexts - when transferring documents in chunks into and out of NetServer; when uploading a document to be saved through the Document dialog, and when handling mails and attachments.

The implementation supplied with NetServer provides these services using temporary files, controlled by the Documents section in the config file with respect to path and impersonation.

CreateFileForAppendingAsync(string, CancellationToken)

Create a temporary 'file' for appending

Declaration
Task<string> CreateFileForAppendingAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

Name to be used for later access. The actual key used by the implementation should also take into account the associate ID, since multiple concurrent users may use the same name, and that does not mean file sharing between users.

CancellationToken cancellationToken
Returns
Type Description
Task<string>
Remarks

Temporary files are used in several contexts - when transferring documents in chunks into and out of NetServer; when uploading a document to be saved through the Document dialog, and when handling mails and attachments.

The implementation supplied with NetServer provides these services using temporary files, controlled by the Documents section in the config file with respect to path and impersonation.

DeleteFileAsync(string, CancellationToken)

Delete a temporary file

Declaration
Task DeleteFileAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

Name identifying the file. See comments in the CreateFile method for more information on how file names are handled.

CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

Temporary files are used in several contexts - when transferring documents in chunks into and out of NetServer; when uploading a document to be saved through the Document dialog, and when handling mails and attachments.

The implementation supplied with NetServer provides these services using temporary files, controlled by the Documents section in the config file with respect to path and impersonation.

ReadFileChunkAsync(string, long, byte[], CancellationToken)

Read a chunk of data from the file (random access read)

Declaration
Task<int> ReadFileChunkAsync(string name, long filePosition, byte[] bufferToUpdate, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

Name identifying the file. See comments in the CreateFile method for more information on how file names are handled.

long filePosition

Position in bytes, starting at 0, to start reading from

byte[] bufferToUpdate

Data buffer to update. The length of this buffer is the maximum number of bytes that will be read

CancellationToken cancellationToken
Returns
Type Description
Task<int>

Actual number of bytes read. If less than the length of the buffer, end-of-file is indicated

Remarks

Temporary files are used in several contexts - when transferring documents in chunks into and out of NetServer; when uploading a document to be saved through the Document dialog, and when handling mails and attachments.

The implementation supplied with NetServer provides these services using temporary files, controlled by the Documents section in the config file with respect to path and impersonation.

ReadFileCompleteAsync(string, CancellationToken)

Make the complete content of the file available as a stream (sequential read)

Declaration
Task<Stream> ReadFileCompleteAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

Name identifying the file. See comments in the CreateFile method for more information on how file names are handled.

CancellationToken cancellationToken
Returns
Type Description
Task<Stream>

Stream representing the entire current contents of the file

Remarks

Temporary files are used in several contexts - when transferring documents in chunks into and out of NetServer; when uploading a document to be saved through the Document dialog, and when handling mails and attachments.

The implementation supplied with NetServer provides these services using temporary files, controlled by the Documents section in the config file with respect to path and impersonation.

WriteFileChunkAsync(string, long, byte[], CancellationToken)

Write a chunk of data to the file (random access write)

Declaration
Task WriteFileChunkAsync(string name, long filePosition, byte[] bufferToWriteFrom, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

Name identifying the file. See comments in the CreateFile method for more information on how file names are handled.

long filePosition

Position in bytes, starting at 0, that will be written to

byte[] bufferToWriteFrom

Buffer to write; buffer length determines the size of the write operation

CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

Temporary files are used in several contexts - when transferring documents in chunks into and out of NetServer; when uploading a document to be saved through the Document dialog, and when handling mails and attachments.

The implementation supplied with NetServer provides these services using temporary files, controlled by the Documents section in the config file with respect to path and impersonation.

WriteFileCompleteAsync(string, Stream, CancellationToken)

(Over)write - not append - the complete content of the file (sequential write). Any previous content is lost

Declaration
Task WriteFileCompleteAsync(string name, Stream data, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

Name identifying the file. See comments in the CreateFile method for more information on how file names are handled.

Stream data

Stream to read data from

CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

Temporary files are used in several contexts - when transferring documents in chunks into and out of NetServer; when uploading a document to be saved through the Document dialog, and when handling mails and attachments.

The implementation supplied with NetServer provides these services using temporary files, controlled by the Documents section in the config file with respect to path and impersonation.

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top