Skip to main content
Version: v3.x

readdirSync

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Read the directory under the /data directory of the Mini Program synchronously.

Type

function readdirSync(option: Option): Result

Parameters

Option

PropertyTypeRequiredDefaultValueDescriptionAPI_LEVEL
pathstringY-Directory path2.0

Result

TypeDescription
Array<string>|undefinedIf undefined is returned, the directory does not exist, otherwise an array of filenames is returned

Example

import { mkdirSync } from '@zos/fs'

const result = mkdirSync({
path: 'content',
})

if (result === 0) {
console.log('mkdirSync success')
}