Editing Content
This guide will walk you through editing content on the Lens Storage Nodes.
For editing files or folders the storage_key addressing is used.
If a storage_key resolves to a folder the entire folder will be replaced and all existing files within the same folder will be deleted.
If a storage_key resolves to a file, the file will be replaced by the new one.
- TS
- curl
Assuming you have a signer instance that satisfies the Signer interface.
interface Signer { signMessage({ message }): Promise<string>;}
Viem's WalletClient class satisfies the Signer interface.
Define the ACL template for the update:
import { lensAccountOnly } from "@lens-protocol/storage-node-client";
const acl = lensAccountOnly("0x6982508145454Ce325dDbE47a25d4ec3d2311933");
Then, edit the file from its lens:// URI as follows:
const updated = new File( ["Ehlo Lens Storage, wen contents ?"], "ehlo-lens-storage.txt", { type: "text/plain", });
const success = await storageClient.editFile("lens://af5225b…", updated, signer, { acl });\
console.log(success); // true
That's it—you successfully edited the resource on the Lens Storage Nodes.