Table of Contents

Method PutAsync

Namespace
NATS.Client.ObjectStore
Assembly
NATS.Client.ObjectStore.dll

PutAsync(string, byte[], CancellationToken)

Put an object by key.

public ValueTask<ObjectMetadata> PutAsync(string key, byte[] value, CancellationToken cancellationToken = default)

Parameters

key string

Object key.

value byte[]

Object value as a byte array.

cancellationToken CancellationToken

A CancellationToken used to cancel the API call.

Returns

ValueTask<ObjectMetadata>

Object metadata.

PutAsync(string, Stream, bool, CancellationToken)

Put an object by key.

public ValueTask<ObjectMetadata> PutAsync(string key, Stream stream, bool leaveOpen = false, CancellationToken cancellationToken = default)

Parameters

key string

Object key.

stream Stream

Stream to read the value from.

leaveOpen bool

true to not close the underlying stream when async method returns; otherwise, false

cancellationToken CancellationToken

A CancellationToken used to cancel the API call.

Returns

ValueTask<ObjectMetadata>

Object metadata.

Exceptions

NatsObjException

There was an error calculating SHA digest.

NatsJSApiException

Server responded with an error.

PutAsync(ObjectMetadata, Stream, bool, CancellationToken)

Put an object by key.

public ValueTask<ObjectMetadata> PutAsync(ObjectMetadata meta, Stream stream, bool leaveOpen = false, CancellationToken cancellationToken = default)

Parameters

meta ObjectMetadata

Object metadata.

stream Stream

Stream to read the value from.

leaveOpen bool

true to not close the underlying stream when async method returns; otherwise, false

cancellationToken CancellationToken

A CancellationToken used to cancel the API call.

Returns

ValueTask<ObjectMetadata>

Object metadata.

Exceptions

NatsObjException

There was an error calculating SHA digest.

NatsJSApiException

Server responded with an error.