FileSystemManager.readdirSync
收藏我的收藏
基础库 1.15.0 开始支持本方法,这是一个同步方法。
读取目录内文件列表。
| 前提条件 | 无 |
| 业务背景 | 无 |
| 使用限制 | 无 |
| 注意事项 | 无 |
| 支持沙盒 | 否 |
| 相关教程 | 无 |
语法
FileSystemManager.readdirSync(dirPath)
参数说明
dirPath
| 类型 | 默认值 | 必填 | 说明 | 最低支 持版本 |
|---|---|---|---|---|
| string | 是 | 要读取的目录路径 | 1.15.0 |
返回值
| 类型 | 说明 | 最低支持版本 |
|---|---|---|
| array | 返回值为指定目录下的文件名数组, 类型为 string[] | 1.15.0 |
错误码
| errorCode | errMsg | errorType | 说明 | 最低支持版本 |
|---|---|---|---|---|
| 108601 | permission denied, %s %s | D | 没有权限 请查看dirPath参数是否正确 | 1.15.0 |
| 108602 | operation not permitted, %s %s | D | 文件路径读取后应该是一个文件 请查看dirPath参数是否正确 | 1.15.0 |
| 108603 | no such file or directory, %s %s-> %s | D | 目标路径或源文件不存在 请查看dirPath参数是否正确 | 1.15.0 |
| 161799 | params dirPath is required | D | dirPath是必传值 请查看dirPath参数是否正确 | 1.15.0 |
扫码体验
请使用字节宿主APP扫码
