# binToDec() function · @imqueue/net

Source: https://imqueue.org/api/net/latest/net.bintodec/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/net 3.0.2 — generated reference, not hand-written

Reads a string of `'0'` and `'1'` as an unsigned `bigint`.

**Signature:**

```typescript
export declare function binToDec(binStr: string): bigint;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| binStr | string | big-endian binary digits, most significant first |


**Returns:**

bigint

The value they encode. An empty string gives `0n`.

## Remarks

Only `'1'` contributes: any other character at a position — including `'0'`, a space or a letter — is treated as a zero bit rather than rejected. So this silently accepts input it cannot represent, and is meant for strings this package produced.

