Method PutAsync
- Namespace
- NATS.Client.ObjectStore
- Assembly
- NATS.Client.ObjectStore.dll
PutAsync(string, byte[], CancellationToken)
Put an object by key.
ValueTask<ObjectMetadata> PutAsync(string key, byte[] value, CancellationToken cancellationToken = default)
Parameters
key
stringObject key.
value
byte[]Object value as a byte array.
cancellationToken
CancellationTokenA CancellationToken used to cancel the API call.
Returns
- ValueTask<ObjectMetadata>
Object metadata.
PutAsync(string, Stream, bool, CancellationToken)
Put an object by key.
ValueTask<ObjectMetadata> PutAsync(string key, Stream stream, bool leaveOpen = false, CancellationToken cancellationToken = default)
Parameters
key
stringObject key.
stream
StreamStream to read the value from.
leaveOpen
booltrue
to not close the underlying stream when async method returns; otherwise,false
cancellationToken
CancellationTokenA 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.
ValueTask<ObjectMetadata> PutAsync(ObjectMetadata meta, Stream stream, bool leaveOpen = false, CancellationToken cancellationToken = default)
Parameters
meta
ObjectMetadataObject metadata.
stream
StreamStream to read the value from.
leaveOpen
booltrue
to not close the underlying stream when async method returns; otherwise,false
cancellationToken
CancellationTokenA 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.