Generate internet-related data including emails, URLs, IP addresses, passwords, and various tech-related information for testing web applications and network systems.
Generate realistic email addresses with various configuration options.
/**
* Generate a random email address
* @param options - Configuration options
* @returns Email address string
*/
email(options?: {
firstName?: string;
lastName?: string;
provider?: string;
allowSpecialCharacters?: boolean;
}): string;
/**
* Generate a safe example email address (using example.* domains)
* @param options - Configuration options
* @returns Safe example email address
*/
exampleEmail(options?: {
firstName?: string;
lastName?: string;
}): string;Generate usernames and display names for user accounts and profiles.
/**
* Generate an ASCII username
* @param options - Configuration options
* @returns ASCII username string
*/
username(options?: {
firstName?: string;
lastName?: string;
}): string;
/**
* Generate a Unicode display name
* @param options - Configuration options
* @returns Unicode display name
*/
displayName(options?: {
firstName?: string;
lastName?: string;
}): string;Generate URLs, domain names, and related web infrastructure data.
/**
* Generate a complete URL
* @param options - Configuration options
* @returns Complete URL string
*/
url(options?: {
appendSlash?: boolean;
protocol?: string;
}): string;
/**
* Generate a domain name
* @returns Domain name string
*/
domainName(): string;
/**
* Generate a domain suffix (TLD)
* @returns Domain suffix (.com, .org, etc.)
*/
domainSuffix(): string;
/**
* Generate a domain word (part of domain name)
* @returns Domain word string
*/
domainWord(): string;
/**
* Generate HTTP protocol
* @returns 'http' or 'https'
*/
protocol(): string;Generate IP addresses, MAC addresses, and network-related information.
/**
* Generate an IP address (IPv4 or IPv6)
* @returns IP address string
*/
ip(): string;
/**
* Generate an IPv4 address with network options
* @param options - Configuration options
* @returns IPv4 address string
*/
ipv4(options?: {
network?: IPv4NetworkType;
cidrBlock?: string;
}): string;
/**
* Generate an IPv6 address
* @returns IPv6 address string
*/
ipv6(): string;
/**
* Generate a MAC address
* @param options - Configuration options
* @returns MAC address string
*/
mac(options?: {
separator?: string;
}): string;
/**
* Generate a port number
* @returns Port number (1-65535)
*/
port(): number;Generate HTTP-related data including methods, status codes, and user agents.
/**
* Generate an HTTP method
* @returns HTTP method string (GET, POST, etc.)
*/
httpMethod(): string;
/**
* Generate an HTTP status code
* @param options - Configuration options
* @returns HTTP status code number
*/
httpStatusCode(options?: {
types?: ('informational' | 'success' | 'clientError' | 'serverError' | 'redirection')[];
}): number;
/**
* Generate a browser user agent string
* @returns User agent string
*/
userAgent(): string;Generate passwords, tokens, and security-related data.
/**
* Generate a password-like string
* @param options - Configuration options
* @returns Password string
*/
password(options?: {
length?: number;
memorable?: boolean;
pattern?: RegExp;
prefix?: string;
}): string;
/**
* Generate a JWT algorithm name
* @returns JWT algorithm string
*/
jwtAlgorithm(): string;
/**
* Generate a complete JWT token
* @param options - Configuration options
* @returns JWT token string
*/
jwt(options?: {
header?: Record<string, unknown>;
payload?: Record<string, unknown>;
refDate?: string | Date | number;
}): string;Generate emoji and other internet-related content.
/**
* Generate a random emoji
* @param options - Configuration options
* @returns Emoji character
*/
emoji(options?: {
types?: ('smiley' | 'body' | 'person' | 'nature' | 'food' | 'travel' | 'activity' | 'object' | 'symbol' | 'flag')[];
}): string;import { faker } from "@faker-js/faker";
// Generate complete user profile
const userProfile = {
username: faker.internet.username(),
email: faker.internet.email(),
displayName: faker.internet.displayName(),
avatar: faker.internet.url(),
password: faker.internet.password({ length: 12, memorable: true })
};
// Generate network configuration
const networkConfig = {
serverIp: faker.internet.ipv4({ network: 'private-a' }),
macAddress: faker.internet.mac(),
port: faker.internet.port(),
protocol: faker.internet.protocol()
};
// Generate API testing data
const apiTestData = {
endpoint: faker.internet.url(),
method: faker.internet.httpMethod(),
statusCode: faker.internet.httpStatusCode({ types: ['success'] }),
userAgent: faker.internet.userAgent(),
jwt: faker.internet.jwt()
};
// Generate safe email for testing
const testEmail = faker.internet.exampleEmail({
firstName: 'john',
lastName: 'doe'
});
// Example: "john.doe@example.com"enum IPv4Network {
Any = 'any',
Loopback = 'loopback',
PrivateA = 'private-a',
PrivateB = 'private-b',
PrivateC = 'private-c',
TestNet1 = 'test-net-1',
TestNet2 = 'test-net-2',
TestNet3 = 'test-net-3',
LinkLocal = 'link-local',
Multicast = 'multicast'
}
type IPv4NetworkType = keyof typeof IPv4Network;