抖音开放平台Logo
开发者文档
“/”唤起搜索
控制台

FileSystemManager.mkdirSync
收藏
我的收藏

基础库 1.15.0 开始支持本方法,这是一个同步方法。

在 用户目录 下创建目录。

前提条件无
业务背景无
使用限制无
注意事项
dirPath 必须以 ttfile://user 开头
相关教程无

语法

FileSystemManager.mkdirSync(dirPath, recursive)

参数说明

dirPath

类型默认值必填说明最低支持版本
string是
创建的目录路径, 必须 ttfile://user 开头
1.15.0

recursive

类型默认值必填说明最低支持版本
boolean否
遍历
1.15.0

返回值

无

错误码

errNoerrMsg说明最低支持版本
10401error stack
小游戏框架内部错误,有需要请创建工单咨询
1.15.0
21101permission denied, $apiName $filePath
1.15.0
21102file already exists, $apiName $filePath
1.15.0
21103no such file or directory, $apiName $filePath
1.15.0
20001invalid param
参数错误
1.15.0
20000params $paramName is required
1.15.0
20000params $paramName type is not $paramType type
1.15.0
20000$paramName is invalid
1.15.0
21104no such file or directory, $apiName $filePath
小游戏框架内部错误,有需要请创建工单咨询
1.15.0
20000internal error
小游戏框架内部错误,有需要请创建工单咨询
1.15.0

扫码体验

请使用字节宿主APP扫码

代码示例

开发者工具中预览

const fileSystemManager = tt.getFileSystemManager(); try { fileSystemManager.mkdirSync("ttfile://user/some/path"); console.log("调用成功"); } catch (err) { console.log("调用失败", err); }