Welcome
User Guide
Developer guide
Reference Guide
Frequently Asked Questions
Pricing policy
Data retention policy
Draft: Default Space How to upgrade by payment?
How to re-subscribe to an expired DID Space
Connecting to the DID Space using the Gateway Address
Switch the DID Space bound to NFT Blender.
The automatic backup of Blocklet is stuck, how can it be quickly restored?
Fix CORS error when connecting DID Space
Change log
Draft: Purchase DID Space
DID Spaces v0.6.0: OAuth Integration in DID Spaces
DID Spaces v0.5.83: OAuth integrated DID Space
Prod Spaces data retention policy updated
DID Spaces v0.4.26 released: subscription fully adopts pay-as-you-go & supports paid upgrade Default Space
DID Spaces v0.3.75 released: Supports reading and writing component spaces
DID Spaces v1.0.48: 支持预览 post/bookmark/blog/doc
GetObjectCommand
GetObjectCommand can help developers get object data on the DID Space.
Parameter Type#
Parameter name | Type | necessary | default value | Explanation |
---|---|---|---|---|
key | string | Y | None | It can be a file name or a folder |
Return Type#
Parameter Name | Type | Necessary | Explanation |
---|---|---|---|
statusCode | number | Y | Return status code |
statusMessage | string | N | Errors should only have values when they occur |
stack | string | N | Stack Information |
data | 易读 | Y | Data of the acquired object |
headers | AxiosResponseHeaders | Y | Response headers |
Example code#
- Read object data
const { SpaceClient, GetObjectCommand } = require('@blocklet/did-space-js');
const getWallet = require('@blocklet/sdk/lib/wallet');
const spaceClient = new SpaceClient({
endpoint,
wallet: getWallet(),
});
const { data } = await spaceClient.send(
new GetObjectCommand({
key: 'hello world!',
})
);
console.log(await streamToString(data));