feat: add list method

Adds list method.
Adds put, get & list examples to README.md.
Bump package version to 0.6.0.
This commit is contained in:
coreyphillips
2024-09-27 13:20:13 -04:00
parent c2c0d114ec
commit d69f834f00
19 changed files with 179 additions and 5 deletions

View File

@@ -212,3 +212,15 @@ export async function resolveHttps(
return err(JSON.stringify(e));
}
}
export async function list(url: string): Promise<Result<string[]>> {
try {
const res = await Pubky.list(url);
if (res[0] === 'error') {
return err(res[1]);
}
return ok(JSON.parse(res[1]));
} catch (e) {
return err(JSON.stringify(e));
}
}