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
SyncFolderPullCommand
This interface is used to synchronize folders on the DID Space to local folders.
Parameter Type#
Parameter Name | Type | Necessary | Default Value | Parameter Description |
---|---|---|---|---|
source``` → ```source | string | Y | - | The source folder that needs to be synchronized, please add a trailing slash `/` to the folder. |
target | string | Y | - | Synchronize the source to the target folder, please add a trailing slash / |
concurrency | number | N | 256 | Concurrency, default is 256. |
retryCount | number | N | 3 | Retry 3 times after synchronization failure |
debug | boolean | N | false | Output debug information |
filter | function | N | Sync all files by default | Filter function, can be used to filter out certain directories or files |
onProgress | function | N | - | Progress callback function |
onAfterUpload | function | N | - | Callback function after upload completion |
tmpDir | string | N | - | Temporary storage directory |
Return type:#
Field Name | Type | necessary | Parameter Description |
statusCode | number | Y | Return Status Code |
---|---|---|---|
statusMessage | string | N | In general, there is only a value when an error occurs |
stack | string | N | Stack Trace |
data.errorCount | number | Y | Number of tasks that encountered an error |
data.count | number | Y | Total number of tasks |
data.duration | number | Y | Time spent, in seconds (s) |
Example code:#
- Sync the folder of DID Spaces to local
const { SpaceClient, SyncFolderPullCommand } = require('@blocklet/did-space-js');
const getWallet = require('@blocklet/sdk/lib/wallet');
const spaceClient = new SpaceClient({
endpoint,
wallet: getWallet(),
});
const syncFolderPullCommand = new SyncFolderPullCommand({
source: 'your_did_spaces/source_folder/',
target: 'target_folder/',
concurrency: 100,
retryCount: 2,
debug: true,
filter: (object, index, objects) => {
// filter logic here
},
onProgress: (input) => {
// progress callback logic here
},
onAfterUpload: (input) => {
// after upload callback logic here
},
tmpDir: 'temp/'
});
const result = await spaceClient.send(syncFolderPullCommand);