Skip to main content
Version: v3

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 { readdirSync } from '@zos/fs'

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