FileInfo
FileInfo
类表示有关文件的信息。
属性
属性 | 类型 | 描述 |
---|---|---|
name | string | 文件名称。 |
size | number | 文件大小(字节)。 |
示例
import { open, SeekMode } from 'k6/experimental/fs';
const file = await open('bonjour.txt');
export default async function () {
// Retrieve information about the file
const fileinfo = await file.stat();
if (fileinfo.name != 'bonjour.txt') {
throw new Error('Unexpected file name');
}
}