---
title: "decodeConsole(): function in Console, TypeShade API"
description: "decodeConsole, a function in Console. Decode a console buffer the host copied back into the events the CPU sink would receive."
url: https://typeshade.dev/api/decodeconsole/
language: en
---

# `decodeConsole()`

Function in Console

Decode a console buffer the host copied back into the events the CPU sink would receive.

`import { decodeConsole } from 'typeshade'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
function decodeConsole(
  buffer: Uint32Array,
  log: ConsoleLog,
): { events: ConsoleEvent[]; dropped: number }
```

## Parameters

**`buffer` `Uint32Array`**

**`log` `ConsoleLog`**

## Return value

`{ events: ConsoleEvent[]; dropped: number }`

## Description

`buffer` is the whole storage buffer as `u32` words: the cursor, the dropped count, then the entries. The events come back in the order the CPU tier runs a dispatch in, by invocation (z, then y, then x) and, within one invocation, in the order the calls ran; each carries its `invocation`. `dropped` counts the calls that did not fit the buffer.

## Source

[`src/core/console.ts`, line 166](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/console.ts#L166), at commit af54ddad5
