Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1013 Bytes

item.md

File metadata and controls

39 lines (28 loc) · 1013 Bytes

Item

Items are used to store and retrieve data on the network.

Contents

Constructor

new Item(options)

  • options:
    • key: String (Optional, if none is provided it will be set to the hash of the value to store) The key used to find and store the value on the network.
    • value: Object The value to store on the network.
    • publisher: String The ID of the node that published the Item on the network.
    • timestamp: Integer Unix timestamp of the creation of the Item.


Creates an Item to be stored on the network.

const plexus = require("plexus");

const item = new plexus.Item({key: key, value: value, publisher: "id", timestamp: 0});

Methods

item.create_hash(data)


Creates a hash of the input data.

//  Use the hash of the item's data as its key
item.key = item.create_hash(item.value);