FileSystemManager.stat

解释:获取文件 Stats 对象。

Web 态说明:受浏览器限制,Web 态不支持文件系统相关功能,调用该方法会执行失败回调函数。

方法参数

Object object

object 参数说明

参数名类型必填默认值说明

path

String

-

临时存储文件路径

success

Function

-

接口调用成功的回调函数

fail

Function

-

接口调用失败的回调函数

complete

Function

-

接口调用结束的回调函数(调用成功、失败都会执行)

success 返回参数说明

参数类型说明

stats

Stats

一个 Stats 类型的对象

stats 返回值说明

参数名参数类型说明

mode

String

文件的类型和存取的权限,对应 POSIX stat.st_mode

size

Number

文件大小(单位:B),对应 POSIX stat.st_size

lastAccessedTime

Number

文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime

lastModifiedTime

Number

文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime

isDirectory

Function

判断当前文件是否一个目录,返回 boolean 值

isFile

Function

判断当前文件是否一个普通文件,返回 boolean 值

示例

跳转编辑工具

在开发者工具中打开

在 WEB IDE 中打开

扫码体验

代码示例

百度智能小程序

请使用百度APP扫码

图片示例

FileSystemManager.stat - 图2

代码示例

  • SWAN
  • JS
  1. <view class="wrap">
  2. <button type="primary" bindtap="stat">获取文件 Stats 对象</button>
  3. </view>