KeyValueStoreClient
Hierarchy
- ResourceClient
- KeyValueStoreClient
Index
Properties
inheritedapifyClient
inheritedbaseUrl
inheritedhttpClient
optionalinheritedid
optionalinheritedparams
inheritedresourcePath
optionalinheritedsafeId
inheritedurl
Methods
delete
Returns Promise<void>
deleteRecord
Parameters
key: string
Returns Promise<void>
get
Returns Promise<undefined | KeyValueStore>
getRecord
You can use the
buffer
option to get the value in a Buffer (Node.js) or ArrayBuffer (browser) format. In Node.js (not in browser) you can also use thestream
option to get a Readable stream.When the record does not exist, the function resolves to
undefined
. It does NOT resolve to aKeyValueStore
record with anundefined
value. https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-recordParameters
key: string
Returns Promise<undefined | KeyValueStoreRecord<JsonValue>>
listKeys
Parameters
options: KeyValueClientListKeysOptions = {}
Returns Promise<KeyValueClientListKeysResult>
recordExists
Tests whether a record with the given key exists in the key-value store without retrieving its value.
https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-record
Parameters
key: string
The queried record key.
Returns Promise<boolean>
true
if the record exists,false
if it does not.
setRecord
The value in the record can be a stream object (detected by having the
.pipe
and.on
methods). However, note that in that case following redirects or retrying the request if it fails (for example due to rate limiting) isn't possible. If you want to keep that behavior, you need to collect the whole stream contents into a Buffer and then send the full buffer. See this StackOverflow answer for an example how to do that.https://docs.apify.com/api/v2#/reference/key-value-stores/record/put-record
Parameters
record: KeyValueStoreRecord<JsonValue>
Returns Promise<void>
update
Parameters
newFields: KeyValueClientUpdateOptions
Returns Promise<KeyValueStore>
https://docs.apify.com/api/v2#/reference/key-value-stores/store-object/delete-store