Skip to content

System

Generates fake data for many computer systems properties.

commonFileExt

Returns a commonly used file extension.

Returns: string

ts
faker.system.commonFileExt(): string
faker.system.commonFileExt() // => "jpg"
faker.system.commonFileExt() // 'gif'

commonFileName

Returns a random file name with a given extension or a commonly used extension.

Parameters

NameTypeDefaultDescription
ext?string

Extension. Empty string is considered to be not set.

Returns: string

ts
faker.system.commonFileName(ext?: string): string
faker.system.commonFileName() // => "account_loan.mpe"
faker.system.commonFileName() // 'dollar.jpg'
faker.system.commonFileName('txt') // 'global_borders_wyoming.txt'

commonFileType

Returns a commonly used file type.

Returns: string

ts
faker.system.commonFileType(): string
faker.system.commonFileType() // => "image"
faker.system.commonFileType() // 'audio'

directoryPath

Returns a directory path.

Returns: string

ts
faker.system.directoryPath(): string
faker.system.directoryPath() // => "/root"
faker.system.directoryPath() // '/etc/mail'

fileExt

Returns a file extension.

Parameters

NameTypeDefaultDescription
mimeType?string

Valid mime-type

Returns: string

ts
faker.system.fileExt(mimeType?: string): string
faker.system.fileExt() // => "aas"
faker.system.fileExt() // 'emf'
faker.system.fileExt('application/json') // 'json'

fileName

Returns a random file name with extension.

Parameters

NameTypeDefaultDescription
options{ ... }{}

An options object.

options.extensionCount?number1

Define how many extensions the file name should have. A negative number will be treated as 0.

Returns: string

ts
faker.system.fileName(options: {
  extensionCount: number
} = {}): string
faker.system.fileName() // => "account_loan.silo"
faker.system.fileName() // 'self_enabling_accountability_toys.kpt'
faker.system.fileName({ extensionCount: 2 }) // 'bike_table.res.vcs'

filePath

Returns a file path.

Returns: string

ts
faker.system.filePath(): string
faker.system.filePath() // => "/root/bus_loan.silo"
faker.system.filePath() // '/usr/local/src/money.dotx'

fileType

Returns a file type.

Returns: string

ts
faker.system.fileType(): string
faker.system.fileType() // => "model"
faker.system.fileType() // 'message'

mimeType

Returns a mime-type.

Returns: string

ts
faker.system.mimeType(): string
faker.system.mimeType() // => "application/vnd.patientecommsdoc"
faker.system.mimeType() // 'video/vnd.vivo'

networkInterface

Returns a random network interface.

Parameters

NameTypeDefaultDescription
options{ ... }{}

The options to use.

options.interfaceSchema?'index' | 'mac' | 'pci' | 'slot'

The interface schema. Can be one of index, slot, mac, pci.

options.interfaceType?'en' | 'wl' | 'ww'

The interface type. Can be one of en, wl, ww.

Returns: string

ts
faker.system.networkInterface(options: {
  interfaceSchema: 'index' | 'mac' | 'pci' | 'slot',
  interfaceType: 'en' | 'wl' | 'ww'
} = {}): string
faker.system.networkInterface() // => "wlxbd9d8d69a674"
faker.system.networkInterface() // 'enp0s3'
faker.system.networkInterface({ interfaceType: 'wl' }) // 'wlo1'
faker.system.networkInterface({ interfaceSchema: 'mac' }) // 'enx000c29c00000'
faker.system.networkInterface({ interfaceType: 'en', interfaceSchema: 'pci' }) // 'enp5s0f1d0'

semver

Returns a semantic version.

Returns: string

ts
faker.system.semver(): string
faker.system.semver() // => "5.5.7"
faker.system.semver() // '1.1.2'

Released under the MIT License.