Skip to main content
Version: v3

statSync

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Get information about the files in the /data directory of the Mini Program synchronously.

Type

function statSync(option: Option): Result

Parameters

Option

PropertyTypeRequiredDefaultValueDescriptionAPI_LEVEL
pathstringY-path2.0

Result

TypeDescription
FSStat|undefinedIf undefined is returned, the target file does not exist, otherwise the file information object is returned

FSStat

PropertyTypeDescriptionAPI_LEVEL
sizenumberThe size of the file in bytes2.0

Example

import { statSync } from '@zos/fs'

const result = statSync({
path: 'test.txt',
})

if (result) {
const { size } = result
console.log(size)
}