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
Property | Type | Required | DefaultValue | Description | API_LEVEL |
---|---|---|---|---|---|
path | string | Y | - | path | 2.0 |
Result
Type | Description |
---|---|
FSStat|undefined | If undefined is returned, the target file does not exist, otherwise the file information object is returned |
FSStat
Property | Type | Description | API_LEVEL |
---|---|---|---|
size | number | The size of the file in bytes | 2.0 |
mtimeMs | number | The timestamp indicating the last time this file was modified expressed in milliseconds since the POSIX Epoch | 2.0 |
Example
import { statAssetsSync } from '@zos/fs'
const result = statAssetsSync({
path: 'test.txt',
})
if (result) {
const { size } = result
console.log(size)
}