Interface File

Generator to generate file related entries.

interface File {
    fileExtension(): string;
    fileMimeType(): string;
}

Methods

  • Suffix appended to a filename indicating its format or type.

    Returns string

    a random file extension

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.file.fileExtension())
    }

    Output (formatted as JSON value)

    "max"
    
  • Defines file format and nature for browsers and email clients using standardized identifiers.

    Returns string

    a random file mime type

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.file.fileMimeType())
    }

    Output (formatted as JSON value)

    "text/html"