Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する

SyncFolderPushCommand


该接口用于将本地的文件夹同步到 DID Space 站点上。

参数类型#

参数名

类型

必要

默认值

参数说明

source

string | SourceObject[]

Y

-

需要被同步的源文件夹,文件夹请添加尾杠 /

target

string

Y

-

将源文件夹同步到的目标文件夹,文件夹请添加尾杠 /

concurrency

number

N

256

并发数,默认为 256

retryCount

number

N

3

同步失败后重试次数,默认重试 3 次

debug

boolean

N

false

是否输出 debug 信息

filter

function

N

默认同步所有文件,不过滤

过滤函数,可用于过滤掉某些目录或文件

tmpDir

string

N

-

可临时存放文件的目录,可不填写,但运行时必须有值

preview

PreviewTemplate

N

-

写入的预览对象

返回类型#

字段名称

类型

必要

参数说明

statusCode

number

Y

返回状态码

statusMessage

string

N

一般来说,发生错误的时候才会有值

stack

string

N

堆栈信息

data.errorCount

number

Y

发生错误的任务数

data.count

number

Y

总任务数

data.duration

number

Y

花费的时间,单位秒(s)

代码示例#

  • 同步本地文件夹到 DID Spaces
const { SpaceClient, SyncFolderPushCommand } = require('@blocklet/did-space-js');
const spaceClient = new SpaceClient({
endpoint,
wallet: getWallet(),
});

const syncFolderPushCommandInput = {
source: 'source-folder/',
target: 'target-folder/',
concurrency: 100,
retryCount: 5,
debug: true,
filter: (object, index, objects) => {...},
tmpDir: 'temp/'
};

const output = await spaceClient.send(new SyncFolderPushCommand(syncFolderPushCommandInput));


你获得 0 积分