Generates a random css hex color code in aesthetically pleasing color palette.
Optional
options: { blueBase?: number; greenBase?: number; redBase?: number }An options object.
Optional
blueBase?: numberThe optional base blue in range between 0
and 255
.
Optional
greenBase?: numberThe optional base green in range between 0
and 255
.
Optional
redBase?: numberThe optional base red in range between 0
and 255
.
Generates a display name using the given person's name as base. The resulting display name may use one or both of the provided names. If the input names include Unicode characters, the resulting display name will contain Unicode characters. It will not contain spaces.
Optional
options: { firstName?: string; lastName?: string }An options object.
Optional
firstName?: stringThe optional first name to use.
Optional
lastName?: stringThe optional last name to use.
faker.internet.displayName() // 'Nettie_Zboncak40'
faker.internet.displayName({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne98' - note surname not used.
faker.internet.displayName({ firstName: 'John', lastName: 'Doe' }) // 'John.Doe'
faker.internet.displayName({ firstName: 'Hélene', lastName: 'Müller' }) // 'Hélene_Müller11'
faker.internet.displayName({ firstName: 'Фёдор', lastName: 'Достоевский' }) // 'Фёдор.Достоевский50'
faker.internet.displayName({ firstName: '大羽', lastName: '陳' }) // '大羽.陳'
Generates an email address using the given person's name as base.
Optional
options: {The options to use.
Optional
allowSpecialCharacters?: booleanWhether special characters such as .!#$%&'*+-/=?^_`{|}~
should be included in the email address.
Optional
firstName?: stringThe optional first name to use.
Optional
lastName?: stringThe optional last name to use.
Optional
provider?: stringThe mail provider domain to use. If not specified, a random free mail provider will be chosen.
faker.internet.email() // 'Kassandra4@hotmail.com'
faker.internet.email({ firstName: 'Jeanne'}) // 'Jeanne63@yahoo.com'
faker.internet.email({ firstName: 'Jeanne'}) // 'Jeanne_Smith63@yahoo.com'
faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne.Doe63@yahoo.com'
faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev' }) // 'Jeanne_Doe88@example.fakerjs.dev'
faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev', allowSpecialCharacters: true }) // 'Jeanne%Doe88@example.fakerjs.dev'
Generates an email address using an example mail provider using the given person's name as base.
Optional
options: { allowSpecialCharacters?: boolean; firstName?: string; lastName?: string }An options object.
Optional
allowSpecialCharacters?: booleanWhether special characters such as .!#$%&'*+-/=?^_`{|}~
should be included in the email address.
Optional
firstName?: stringThe optional first name to use.
Optional
lastName?: stringThe optional last name to use.
faker.internet.exampleEmail() // 'Helmer.Graham23@example.com'
faker.internet.exampleEmail({ firstName: 'Jeanne' }) // 'Jeanne96@example.net'
faker.internet.exampleEmail({ firstName: 'Jeanne' }) // 'Jeanne.Smith96@example.net'
faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne_Doe96@example.net'
faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe', allowSpecialCharacters: true }) // 'Jeanne%Doe88@example.com'
Generates a random HTTP status code.
Optional
options: { types?: readonly HTTPStatusCodeType[] }Options object.
Optional
types?: readonly HTTPStatusCodeType[]A list of the HTTP status code types that should be used.
Generates a random IPv4 address.
Optional
options: { cidrBlock?: string }The optional options object.
Optional
cidrBlock?: stringThe optional CIDR block to use. Must be in the format x.x.x.x/y
.
Generates a random IPv4 address.
Optional
options: {The optional options object.
Optional
network?: The optional network to use. This is intended as an alias for well-known cidrBlock
s.
Generates a random IPv4 address.
Optional
options: The optional options object.
Optional
cidrBlock?: stringThe optional CIDR block to use. Must be in the format x.x.x.x/y
.
Optional
network?: The optional network to use. This is intended as an alias for well-known cidrBlock
s.
Generates a random JWT (JSON Web Token).
Please note that this method generates a random signature instead of a valid one.
Optional
options: {The optional options object.
Optional
header?: Record<string, unknown>The header to use for the token. If present, it will replace any default values.
Optional
payload?: Record<string, unknown>The payload to use for the token. If present, it will replace any default values.
Optional
refDate?: string | number | DateThe date to use as reference point for the newly generated date.
faker.internet.jwt() // 'eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MzI2MzgxMDYsImV4cCI6MTczMjY5MjUwOSwib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uZCBQYXVjZWsiLCJzdWIiOiI5NzVjMjMyOS02MDlhLTRjYTYtYjBkZi05ZmY4MGZiNDUwN2QiLCJhdWQiOiI0ODQxZWYwNi01OWYwLTQzMWEtYmFmZi0xMjkxZmRhZDdhNjgiLCJqdGkiOiJmNDBjZTJiYi00ZWYyLTQ1MjMtOGIxMy1kN2Q4NTA5N2M2ZTUifQ.cuClEZQ0CyPIMVS5uxrMwWXz0wcqFFdt0oNne3PMryyly0jghkxVurss2TapMC3C'
Generates a random mac address.
Optional
options: string | { separator?: string }The optional separator or an options object.
Optional
separator?: stringThe optional separator to use. Can be either ':'
, '-'
or ''
.
Generates a random password-like string. Do not use this method for generating actual passwords for users. Since the source of the randomness is not cryptographically secure, neither is this generator.
Optional
options: { length?: number; memorable?: boolean; pattern?: RegExp; prefix?: string }An options object.
Optional
length?: numberThe length of the password to generate.
Optional
memorable?: booleanWhether the generated password should be memorable.
Optional
pattern?: RegExpThe pattern that all chars should match.
This option will be ignored, if memorable
is true
.
Optional
prefix?: stringThe prefix to use.
faker.internet.password() // '89G1wJuBLbGziIs'
faker.internet.password({ length: 20 }) // 'aF55c_8O9kZaPOrysFB_'
faker.internet.password({ length: 20, memorable: true }) // 'lawetimufozujosodedi'
faker.internet.password({ length: 20, memorable: true, pattern: /[A-Z]/ }) // 'HMAQDFFYLDDUTBKVNFVS'
faker.internet.password({ length: 20, memorable: true, pattern: /[A-Z]/, prefix: 'Hello ' }) // 'Hello IREOXTDWPERQSB'
Generates a random http(s) url.
Optional
options: { appendSlash?: boolean; protocol?: HTTPProtocolType }Optional options object.
Optional
appendSlash?: booleanWhether to append a slash to the end of the url (path).
Optional
protocol?: HTTPProtocolTypeThe protocol to use.
Generates a username using the given person's name as base. The resulting username may use neither, one or both of the names provided. This will always return a plain ASCII string. Some basic stripping of accents and transliteration of characters will be done.
Optional
options: { firstName?: string; lastName?: string }An options object.
Optional
firstName?: stringThe optional first name to use.
Optional
lastName?: stringThe optional last name to use.
faker.internet.username() // 'Nettie_Zboncak40'
faker.internet.username({ firstName: 'Jeanne' }) // 'Jeanne98'
faker.internet.username({ firstName: 'Jeanne' }) // 'Jeanne.Smith98'
faker.internet.username({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne_Doe98'
faker.internet.username({ firstName: 'John', lastName: 'Doe' }) // 'John.Doe'
faker.internet.username({ firstName: 'Hélene', lastName: 'Müller' }) // 'Helene_Muller11'
faker.internet.username({ firstName: 'Фёдор', lastName: 'Достоевский' }) // 'Fedor.Dostoevskii50'
faker.internet.username({ firstName: '大羽', lastName: '陳' }) // 'hlzp8d.tpv45' - note neither name is used
Generates a username using the given person's name as base. The resulting username may use neither, one or both of the names provided. This will always return a plain ASCII string. Some basic stripping of accents and transliteration of characters will be done.
Optional
options: { firstName?: string; lastName?: string }An options object.
Optional
firstName?: stringThe optional first name to use.
Optional
lastName?: stringThe optional last name to use.
faker.internet.userName() // 'Nettie_Zboncak40'
faker.internet.userName({ firstName: 'Jeanne' }) // 'Jeanne98'
faker.internet.userName({ firstName: 'Jeanne' }) // 'Jeanne.Smith98'
faker.internet.userName({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne_Doe98'
faker.internet.userName({ firstName: 'John', lastName: 'Doe' }) // 'John.Doe'
faker.internet.userName({ firstName: 'Hélene', lastName: 'Müller' }) // 'Helene_Muller11'
faker.internet.userName({ firstName: 'Фёдор', lastName: 'Достоевский' }) // 'Fedor.Dostoevskii50'
faker.internet.userName({ firstName: '大羽', lastName: '陳' }) // 'hlzp8d.tpv45' - note neither name is used
Module to generate internet related entries.
Overview
For user accounts, you may need an
email()
and apassword()
, as well as a ASCIIusername()
or UnicodedisplayName()
. Since the emails generated could coincidentally be real email addresses, you should not use these for sending real email addresses. If this is a concern, useexampleEmail()
instead.For websites, you can generate a
domainName()
or a fullurl()
.To make your data more 🔥, you can use
emoji()
.You also have access to a number of the more technical elements of web requests, such as
httpMethod
,httpStatusCode
,ip
,mac
,userAgent
, andport
.