Skip to content

System

Generates fake data for many computer systems properties.

commonFileExt

Returns a commonly used file extension.

Available since v3.1.0

Returns: string

ts
function commonFileExt(): string;

Examples

ts
faker.system.commonFileExt() // 'jpe'

commonFileName

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

Available since v3.1.0

Parameters

NameTypeDefaultDescription
extension?string

The file extension to use. Empty string is considered to be not set.

Returns: string

ts
function commonFileName(extension?: string): string;

Examples

ts
faker.system.commonFileName() // 'tapioca_blaring.pdf'
faker.system.commonFileName('txt') // 'successfully.txt'

commonFileType

Returns a commonly used file type.

Available since v3.1.0

Returns: string

ts
function commonFileType(): string;

Examples

ts
faker.system.commonFileType() // 'image'

cron

Returns a random cron expression.

Available since v7.5.0

Parameters

NameTypeDefaultDescription
options{ ... }{}

The optional options to use.

options.includeNonStandard?booleanfalse

Whether to include a @yearly, @monthly, @daily, etc text labels in the generated expression.

options.includeYear?booleanfalse

Whether to include a year in the generated expression.

Returns: string

ts
function cron(
  options: {
    includeYear?: boolean;
    includeNonStandard?: boolean;
  } = {}
): string;

Examples

ts
faker.system.cron() // '* * * * *'
faker.system.cron({ includeYear: true }) // '* * * * 5 *'
faker.system.cron({ includeYear: false }) // '* 22 * * *'
faker.system.cron({ includeNonStandard: false }) // '40 8 14 9 *'
faker.system.cron({ includeNonStandard: true }) // '59 2 7 * 4'

directoryPath

Returns a directory path.

Available since v3.1.0

Returns: string

ts
function directoryPath(): string;

Examples

ts
faker.system.directoryPath() // '/root'

fileExt

Returns a file extension.

Available since v3.1.0

Parameters

NameTypeDefaultDescription
mimeType?string

Valid mime-type

Returns: string

ts
function fileExt(mimeType?: string): string;

Examples

ts
faker.system.fileExt() // '3g2'
faker.system.fileExt('application/json') // 'map'

fileName

Returns a random file name with extension.

Available since v3.1.0

Parameters

NameTypeDefaultDescription
options{ ... }{}

An options object.

options.extensionCount?number | { min: number; max: number; }1

Define how many extensions the file name should have.

Returns: string

ts
function fileName(
  options: {
    extensionCount?:
      | number
      | {
          min: number;
          max: number;
        };
  } = {}
): string;

Examples

ts
faker.system.fileName() // 'tapioca_blaring.lrf'
faker.system.fileName({ extensionCount: 2 }) // 'successfully.distz.ogg'
faker.system.fileName({ extensionCount: { min: 1, max: 2 } }) // 'midst.m2a'

filePath

Returns a file path.

Available since v3.1.0

Returns: string

ts
function filePath(): string;

Examples

ts
faker.system.filePath() // '/root/whole_busily_jive.ico'

fileType

Returns a file type.

Available since v3.1.0

Returns: string

ts
function fileType(): string;

Examples

ts
faker.system.fileType() // 'image'

mimeType

Returns a mime-type.

Available since v3.1.0

Returns: string

ts
function mimeType(): string;

Examples

ts
faker.system.mimeType() // 'audio/midi'

networkInterface

Returns a random network interface.

Available since v7.4.0

Parameters

NameTypeDefaultDescription
options{ ... }{}

The options to use.

options.interfaceSchema?'index' | 'slot' | 'mac' | 'pci'faker.helpers.objectKey(['index' | 'slot' | 'mac' | 'pci'])

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

options.interfaceType?'en' | 'wl' | 'ww'faker.helpers.arrayElement(['en', 'wl', 'ww'])

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

Returns: string

ts
function networkInterface(
  options: {
    interfaceType?: (typeof commonInterfaceTypes)[number];
    interfaceSchema?: keyof typeof commonInterfaceSchemas;
  } = {}
): string;

Examples

ts
faker.system.networkInterface() // 'wlx986a7ef6c89e'
faker.system.networkInterface({ interfaceType: 'wl' }) // 'wlo0'
faker.system.networkInterface({ interfaceSchema: 'mac' }) // 'enxdcdfc7c1a2f8'
faker.system.networkInterface({ interfaceType: 'en', interfaceSchema: 'pci' }) // 'P2enp7s4d6'

semver

Returns a semantic version.

Available since v3.1.0

Returns: string

ts
function semver(): string;

Examples

ts
faker.system.semver() // '5.15.12'

Released under the MIT License.