AcediaDocumentation

crypt.generatebytes

Generates random bytes and encodes them in Base64.

The returned string is Base64, so its length differs from the raw byte count. Uses the operating system random generator.

crypt.generatebytes(length: number?): string

Parameters

ParameterTypeDescription
lengthnumber?Raw byte count; defaults to 16. Valid range is 1–65,536.

Errors: Zero, negative or greater-than-65,536 byte counts raise an error.

On this page