Documentation Index
Fetch the complete documentation index at: https://mintlify.com/visible/cruel/llms.txt
Use this file to discover all available pages before exploring further.
cruel.network.latency()
Adds network latency to a function.The function to wrap
Latency in milliseconds, or range [min, max] for random latency
T - Function with network latency
Example
cruel.network.packetLoss()
Simulates packet loss by throwing network errors.The function to wrap
Packet loss rate (0-1). Default is 0.1 (10%)
T - Function that throws CruelNetworkError("packet_loss") at the specified rate
Example
cruel.network.disconnect()
Simulates network disconnection.The function to wrap
Disconnection rate (0-1). Default is 0.05 (5%)
T - Function that throws CruelNetworkError("disconnect") at the specified rate
Example
cruel.network.dns()
Simulates DNS lookup failures.The function to wrap
DNS failure rate (0-1). Default is 0.02 (2%)
T - Function that throws CruelNetworkError("dns_failure") at the specified rate
Example
cruel.network.bandwidth()
Simulates bandwidth throttling by delaying based on response size.The function to wrap (must return a string)
Bandwidth limit in kilobits per second. Default is 256 kbps
T - Function with bandwidth throttling
Note: Delay is calculated based on response size: (bytes * 8 * 1000) / (kbps * 1024) ms
Example
cruel.network.slow()
Simulates a slow network with high latency and jitter.The function to wrap
T - Function with slow network characteristics
Behavior: Applies chaos with:
delay: [1000, 5000]jitter: 2000
Example
cruel.network.unstable()
Simulates an unstable network with disconnections, packet loss, and variable latency.The function to wrap
T - Function with unstable network behavior
Behavior:
- 10% chance of disconnect
- 5% chance of packet loss
- Random delay between 100-2000ms
Example
cruel.network.offline()
Simulates complete network failure (always throws).The function to wrap (not executed)
T - Function that always throws CruelNetworkError("offline")