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
keystringObject key.
valuebyte[]Object value as a byte array.
cancellationTokenCancellationTokenA 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
keystringObject key.
streamStreamStream to read the value from.
leaveOpenbooltrueto not close the underlying stream when async method returns; otherwise,falsecancellationTokenCancellationTokenA 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
metaObjectMetadataObject metadata.
streamStreamStream to read the value from.
leaveOpenbooltrueto not close the underlying stream when async method returns; otherwise,falsecancellationTokenCancellationTokenA 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.