Skip to main content

Read from Decentralized Web Nodes

Before reading from your Decentralized Web Node (DWN), be sure to check out our Quickstart guide to ensure you’ve properly imported the Web5 SDK. Additionally, make sure you’ve set up a DID before attempting to read from a DWN.

Read from a DWN

The following snippet allows you to read from your Web5 instance’s DWN:

// Create the record
const { record } = await web5.dwn.records.create({
data: "Hello Web5",
message: {
dataFormat: 'text/plain',
},
});
// Read the record
const readResult = await record.data.text();

Was this page helpful?

Connect with us on Discord

Submit feedback: Open a GitHub issue

Edit this page: GitHub Repo

Contribute: Contributing Guide