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
- keystring
- Object key. 
- valuebyte[]
- Object value as a byte array. 
- cancellationTokenCancellationToken
- 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
- keystring
- Object key. 
- streamStream
- Stream to read the value from. 
- leaveOpenbool
- trueto not close the underlying stream when async method returns; otherwise,- false
- cancellationTokenCancellationToken
- 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
- metaObjectMetadata
- Object metadata. 
- streamStream
- Stream to read the value from. 
- leaveOpenbool
- trueto not close the underlying stream when async method returns; otherwise,- false
- cancellationTokenCancellationToken
- 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.