# Stats|Array.&ltStats&gt FileSystemManager.statSync(string path, boolean recursive)

with Promise style call: Not supported

Mini Program plugin: Support, need to Mini Program base library version no less than 2.19.2

FileSystemManager.state The synchronous version of

# parameter

# string path

file/Directory path (Local path)

# boolean recursive

Start from base library version 2.3.0. Please remaining backward compatible.

For each file in the directory Stats information

# Return value

# Stats|Array.&ltStats&gt stats

when recursive for false When res.stats It's a... Stats Object. when recursive for true and path Is a directory path, res.stats It's a... Array, each item in an array is an object, and each object contains path and stats。

# error

Error code Error message Introductions
fail permission denied, open ${path} Specified path Path not read
fail No such file or directory ${path} File does not exist
fail sdcard not mounted Android sdcard Mount failure

# sample code

recursive for false time

let fs = wx.getFileSystemManager()
  path: `${wx.env.USER_DATA_PATH}/testDir`,
  success: res => {

recursive for true time

  path: `${wx.env.USER_DATA_PATH}/testDir`,
  recursive: true,
  success: res => {
    Object.keys(res.stats).forEach(path => {
      let stats = res.stats[path]
      console.log(path, stats.isDirectory())