Class: Metadata

src/metadata~Metadata

new Metadata()

Class for storing metadata. Keys are normalized to lowercase ASCII.
Source:

Methods

add(key, value)

Adds the given value for the given key. Normalizes the key.
Parameters:
Name Type Description
key String The key to add to.
value String | Buffer The value to add. Must be a buffer if and only if the normalized key ends with '-bin'
Source:

clone() → {Metadata}

Clone the metadata object.
Source:
Returns:
The new cloned object
Type
Metadata

get(key) → {Array.<(String|Buffer)>}

Gets a list of all values associated with the key. Normalizes the key.
Parameters:
Name Type Description
key String The key to get
Source:
Returns:
The values associated with that key
Type
Array.<(String|Buffer)>

getMap() → {Object.<String, (String|Buffer)>}

Get a map of each key to a single associated value. This reflects the most common way that people will want to see metadata.
Source:
Returns:
A key/value mapping of the metadata
Type
Object.<String, (String|Buffer)>

remove(key)

Remove the given key and any associated values. Normalizes the key.
Parameters:
Name Type Description
key String The key to remove
Source:

set(key, value)

Sets the given value for the given key, replacing any other values associated with that key. Normalizes the key.
Parameters:
Name Type Description
key String The key to set
value String | Buffer The value to set. Must be a buffer if and only if the normalized key ends with '-bin'
Source: