open-index/open-npm huggingface dataset:
npm package: @hazae41/base64url
Description: Base64Url adapter for WebAssembly and JS implementations
Author: hazae41
Latest version: 1.0.20

# Base64Url

Base64Url adapter for WebAssembly and JS implementations

```bash
npm i @hazae41/base64url
```

[**Node Package 📦**](https://www.npmjs.com/package/@hazae41/base64url)

## Features

### Current features
- 100% TypeScript and ESM
- No external dependencies

## Getting started

### Buffer (NodeJS)

```typescript
import { Base64Url } from "@hazae41/base64url"

Base64Url.set(Base64Url.fromBuffer())
```

### WebAssembly

```bash
npm i @hazae41/base64.wasm"
```

```typescript
import { Base64Url } from "@hazae41/base64url"
import { Base64Wasm } from "@hazae41/base64.wasm"

await Base64Wasm.initBundled()

Base64Url.set(Base64Url.fromBufferOrWasm(Base64Wasm))
```

### Scure (JavaScript)

```bash
npm i @scure/base
```

```typescript
import { Base64Url } from "@hazae41/base64url"
import * as Scure from "@scure/base"

Base64Url.set(Base64Url.fromBufferOrScure(Scure))
```

## Usage

```tsx
const encoded: string = Base64Url.get().getOrThrow().encodeUnpaddeOrThrow(new Uint8Array([1,2,3,4,5]))
using decoded: Copiable = Base64Url.get().getOrThrow().decodeUnpaddedOrThrow(encoded)
const decoded2: Uint8Array = decoded.bytes.slice()
```
npm package: @hazae41/binary
Description: Zero-copy binary data types
Author: hazae41
Latest version: 2.0.2

<div align="center">
<img src="https://user-images.githubusercontent.com/4405263/219944821-62f41f78-522b-4d10-92fb-923ae6c36602.png" />
</div>

```bash
npm install @hazae41/binary
```

```bash
deno install jsr:@hazae41/binary
```

[**📦 NPM**](https://www.npmjs.com/package/@hazae41/binary) • [**📦 JSR**](https://jsr.io/@hazae41/binary)

## Features

### Current features
- 100% TypeScript and ESM
- No external dependencies
- Zero-copy reading and writing
- Rust-like patterns
- Unit-tested

## Usage

#### Writable

```typescript
class MyObject implements Writable {

  constructor(
    readonly x: number,
    readonly y: number
  ) {}

  sizeOrThrow() {
    return 1 + 2
  }

  writeOrThrow(cursor: Cursor) {
    cursor.writeUint8OrThrow(this.x)
    cursor.writeUint16OrThrow(this.y)
  }

}
```

```typescript
const myobject = new MyObject(1, 515)
const bytes = Writable.writeToBytesOrThrow(myobject) // Uint8Array([1, 2, 3])
```

#### Readable

```typescript
class MyObject {

  constructor(
    readonly x: number,
    readonly y: number
  ) {}

  static readOrThrow(cursor: Cursor): MyObject {
    const x = cursor.readUint8OrThrow()
    const y = cursor.readUint16OrThrow()

    return new MyObject(x, y)
  }

}
```

```typescript
const bytes = new Uint8Array([1, 2, 3])
const myobject = Readable.readFromBytesOrThrow(MyObject, bytes) // MyObject(1, 515)
```

#### Opaque

This is a binary data type that just holds bytes, it can be used when a binary data type is required

```typescript
const bytes = new Uint8Array([1, 2, 3])
const opaque = Readable.readFromBytesOrThrow(Opaque.Uncopied, bytes) // Opaque(Uint8Array([1, 2, 3]))
const myobject = opaque.readIntoOrThrow(MyObject) // MyObject(1, 515)
```

```typescript
const myobject = new MyObject(1, 515)
const opaque = Opaque.writeFromOrThrow(myobject) // Opaque.Copied(Uint8Array([1, 2, 3]))
const bytes = Writable.writeToBytesOrThrow(opaque) // Uint8Array([1, 2, 3])
```
npm package: @hazae41/bitset
Description: Utilities for arithmetic bitwise operations in JavaScript
Author: hazae41
Latest version: 1.0.1

# Bitset

Utilities for arithmetic bitwise operations in JavaScript

```bash
npm i @hazae41/bitset
```

[**Node Package 📦**](https://www.npmjs.com/package/@hazae41/bitset)

### Current features
- 100% TypeScript and ESM
- Unit-tested
- Big-endian and little-endian
- Export to uint32
- Builder pattern

### Usage

```typescript
const bitset = new Bitset(0x00, 8)

const result = bitset
  .toggleLE(1) // 0000 0010
  .toggleBE(1) // 0100 0010
  .unsign() // >>> 0
  .value

const last6 = bitset
  .last(6) // 00 0010
  .toString() // "000010"
```