Skip to main content
Version: v3

statAssetsSync

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Synchronously gets information about the files in the Mini Program /assets directory.

Type

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

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

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