# @jihyunlab/web-buffer

> JihyunLab Web buffer.

Latest version **1.0.1** (published 2024-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jihyunlab/web-buffer
pnpm add @jihyunlab/web-buffer
yarn add @jihyunlab/web-buffer
bun add @jihyunlab/web-buffer
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2024-07-17 |
| First published | 2024-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | JihyunLab |
| Maintainers | jihyunlab-donghyun, jihyunlab-jh, jihyunlab-dh, jihyunlab-jmin, jihyunlab-phil, jihyunlab-dev |
| Keywords | web-buffer, web, buffer, hex, base64, base64url, utf8, uint8array |

## Links

- npm: https://www.npmjs.com/package/@jihyunlab/web-buffer
- Repository: https://github.com/jihyunlab/web-buffer
- Homepage: https://jihyunlab.com/library/npm/web-buffer
- Issues: https://github.com/jihyunlab/web-buffer/issues
- npm.io page: https://npm.io/package/@jihyunlab/web-buffer

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2024-07-17
- 1.0.0 — 2024-07-13

## README

# @jihyunlab/web-buffer

[![Version](https://img.shields.io/npm/v/@jihyunlab/web-buffer.svg?style=flat-square)](https://www.npmjs.com/package/@jihyunlab/web-buffer?activeTab=versions) [![Downloads](https://img.shields.io/npm/dt/@jihyunlab/web-buffer.svg?style=flat-square)](https://www.npmjs.com/package/@jihyunlab/web-buffer) [![Last commit](https://img.shields.io/github/last-commit/jihyunlab/web-buffer.svg?style=flat-square)](https://github.com/jihyunlab/web-buffer/graphs/commit-activity) [![License](https://img.shields.io/github/license/jihyunlab/web-buffer.svg?style=flat-square)](https://github.com/jihyunlab/web-buffer/blob/master/LICENSE) [![Linter](https://img.shields.io/badge/linter-eslint-blue?style=flat-square)](https://eslint.org) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\
[![Build](https://github.com/jihyunlab/web-buffer/actions/workflows/build.yml/badge.svg)](https://github.com/jihyunlab/web-buffer/actions/workflows/build.yml) [![Lint](https://github.com/jihyunlab/web-buffer/actions/workflows/lint.yml/badge.svg)](https://github.com/jihyunlab/web-buffer/actions/workflows/lint.yml) [![Prettier](https://github.com/jihyunlab/web-buffer/actions/workflows/prettier.yml/badge.svg)](https://github.com/jihyunlab/web-buffer/actions/workflows/prettier.yml) [![codecov](https://codecov.io/gh/jihyunlab/web-buffer/graph/badge.svg?token=QJX5G75FXA)](https://codecov.io/gh/jihyunlab/web-buffer)

@jihyunlab/web-buffer provides data conversion capabilities in web application environments where Node.js's Buffer class cannot be used.

## Installation

```bash
npm i @jihyunlab/web-buffer
```

## Usage

You can create a buffer and convert data based on encoding type.\
Encoding types are provided for Hex, Base64, Base64URL, UTF-8, and Uint8Array data.

```
import { WebBuffer } from '@jihyunlab/web-buffer';

const buffer = WebBuffer.from(
  'jihyunlab',
  'utf8' /* hex, base64, base64url, utf8, uint8array */
);

const hex = buffer.toString('hex');
console.log(hex); // 6a696879756e6c6162

const base64 = buffer.toString('base64');
console.log(base64); // amloeXVubGFi

const base64Url = buffer.toString('base64url');
console.log(base64Url); // amloeXVubGFi

const utf8 = buffer.toString('utf8');
console.log(utf8); // jihyunlab

const uint8Array = buffer.toUint8Array();
console.log(uint8Array); // Uint8Array(9) [106, 105, 104, 121, 117, 110, 108, 97, 98]
```

Uint8Array data can create buffer without defining an encoding type.

```
const buffer = WebBuffer.from(
  new Uint8Array([106, 105, 104, 121, 117, 110, 108, 97, 98])
);
```

UTF-8 data can be converted without defining the encoding type.

```
const utf8 = buffer.toString();
```

## Credits

Authored and maintained by JihyunLab <<info@jihyunlab.com>>

## License

Open source [licensed as MIT](https://github.com/jihyunlab/web-buffer/blob/master/LICENSE).

---
_Source: https://npm.io/package/@jihyunlab/web-buffer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
