菜单
开源

FileInfo

FileInfo 类表示有关文件的信息。

属性

属性类型描述
namestring文件名称。
sizenumber文件大小(字节)。

示例

JavaScript
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');
  }
}