Class DataStreamer
Provides the interface for uploading and downloading data chunks for file entities.
Inheritance
Inherited Members
Namespace: MongoDB.Entities
Assembly: MongoDB.Entities.dll
Syntax
public class DataStreamer
Methods
DeleteBinaryChunks(IClientSessionHandle, CancellationToken)
Deletes only the binary chunks stored in the database for this file entity.
Declaration
public Task DeleteBinaryChunks(IClientSessionHandle session = null, CancellationToken cancellation = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IClientSessionHandle | session | An optional session if using within a transaction |
CancellationToken | cancellation | An optional cancellation token. |
Returns
Type | Description |
---|---|
Task |
DownloadAsync(Stream, Int32, CancellationToken, IClientSessionHandle)
Download binary data for this file entity from mongodb in chunks into a given stream.
Declaration
public async Task DownloadAsync(Stream stream, int batchSize = 1, CancellationToken cancellation = default(CancellationToken), IClientSessionHandle session = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The output stream to write the data |
Int32 | batchSize | The number of chunks you want returned at once |
CancellationToken | cancellation | An optional cancellation token. |
IClientSessionHandle | session | An optional session if using within a transaction |
Returns
Type | Description |
---|---|
Task |
DownloadWithTimeoutAsync(Stream, Int32, Int32, IClientSessionHandle)
Download binary data for this file entity from mongodb in chunks into a given stream with a timeout period.
Declaration
public Task DownloadWithTimeoutAsync(Stream stream, int timeOutSeconds, int batchSize = 1, IClientSessionHandle session = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The output stream to write the data |
Int32 | timeOutSeconds | The maximum number of seconds allowed for the operation to complete |
Int32 | batchSize | |
IClientSessionHandle | session |
Returns
Type | Description |
---|---|
Task |
UploadAsync(Stream, Int32, CancellationToken, IClientSessionHandle)
Upload binary data for this file entity into mongodb in chunks from a given stream.
TIP: Make sure to save the entity before calling this method.
Declaration
public async Task UploadAsync(Stream stream, int chunkSizeKB = 256, CancellationToken cancellation = default(CancellationToken), IClientSessionHandle session = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The input stream to read the data from |
Int32 | chunkSizeKB | The 'average' size of one chunk in KiloBytes |
CancellationToken | cancellation | An optional cancellation token. |
IClientSessionHandle | session | An optional session if using within a transaction |
Returns
Type | Description |
---|---|
Task |
UploadWithTimeoutAsync(Stream, Int32, Int32, IClientSessionHandle)
Upload binary data for this file entity into mongodb in chunks from a given stream with a timeout period.
Declaration
public Task UploadWithTimeoutAsync(Stream stream, int timeOutSeconds, int chunkSizeKB = 256, IClientSessionHandle session = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The input stream to read the data from |
Int32 | timeOutSeconds | The maximum number of seconds allowed for the operation to complete |
Int32 | chunkSizeKB | The 'average' size of one chunk in KiloBytes |
IClientSessionHandle | session | An optional session if using within a transaction |
Returns
Type | Description |
---|---|
Task |