https://github.com/hugoalh/adler32-es
An ES (JavaScript & TypeScript) CLI and module to get the checksum of the data with algorithm Adler32.
https://github.com/hugoalh/adler32-es
adler32 checksum es javascript js modulejs ts typescript
Last synced: 7 months ago
JSON representation
An ES (JavaScript & TypeScript) CLI and module to get the checksum of the data with algorithm Adler32.
- Host: GitHub
- URL: https://github.com/hugoalh/adler32-es
- Owner: hugoalh
- License: other
- Created: 2024-11-16T09:14:23.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-04-08T10:25:17.000Z (7 months ago)
- Last Synced: 2025-04-11T22:12:27.049Z (7 months ago)
- Topics: adler32, checksum, es, javascript, js, modulejs, ts, typescript
- Language: TypeScript
- Homepage:
- Size: 96.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Citation: CITATION.cff
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Adler32 (ES)
[**โ๏ธ** MIT](./LICENSE.md)
[](https://github.com/hugoalh/adler32-es)
[](https://jsr.io/@hugoalh/adler32)
[](https://www.npmjs.com/package/@hugoalh/adler32)
An ES (JavaScript & TypeScript) CLI and module to get the checksum of the data with algorithm Adler32.
## ๐ฐ Begin
### ๐ฏ Targets
| | **Remote** | **JSR** | **NPM** |
|:--|:--|:--|:--|
| **[Bun](https://bun.sh/)** >= v1.1.0 | โ | โ | โ๏ธ |
| **[Cloudflare Workers](https://workers.cloudflare.com/)** | โ | โ | โ๏ธ |
| **[Deno](https://deno.land/)** >= v1.42.0 | โ๏ธ | โ๏ธ | โ๏ธ |
| **[NodeJS](https://nodejs.org/)** >= v16.13.0 | โ | โ | โ๏ธ |
> [!NOTE]
> - It is possible to use this module in other methods/ways which not listed in here, however those methods/ways are not officially supported, and should beware maybe cause security issues.
### #๏ธโฃ Resources Identifier
- **Remote - GitHub Raw:**
```
https://raw.githubusercontent.com/hugoalh/adler32-es/{Tag}/mod.ts
```
- **JSR:**
```
[jsr:]@hugoalh/adler32[@{Tag}]
```
- **NPM:**
```
[npm:]@hugoalh/adler32[@{Tag}]
```
> [!NOTE]
> - For usage of remote resources, it is recommended to import the entire module with the main path `mod.ts`, however it is also able to import part of the module with sub path if available, but do not import if:
>
> - it's path has an underscore prefix (e.g.: `_foo.ts`, `_util/bar.ts`), or
> - it is a benchmark or test file (e.g.: `foo.bench.ts`, `foo.test.ts`), or
> - it's symbol has an underscore prefix (e.g.: `_bar`, `_foo`).
>
> These elements are not considered part of the public API, thus no stability is guaranteed for them.
> - For usage of JSR or NPM resources, it is recommended to import the entire module with the main entrypoint, however it is also able to import part of the module with sub entrypoint if available, please visit the [file `jsr.jsonc`](./jsr.jsonc) property `exports` for available sub entrypoints.
> - It is recommended to use this module with tag for immutability.
### ๐ก๏ธ Runtime Permissions
- File System - Read \[Deno: `read`; NodeJS (>= v20.9.0) ๐งช: `fs-read`\]
- *Resources* (Optional)
## ๐งฉ APIs
- ```ts
class Adler32 {
constructor(data?: Adler32AcceptDataType);
get freezed(): boolean;
freeze(): this;
hash(): bigint;
hashBase16(): string;
hashBase32Hex(): string;
hashBase36(): string;
hashBigInt(): bigint;
hashHex(): string;
hashHexPadding(): string;
hashNumber(): number;
update(data: Adler32AcceptDataType): this;
static fromStream(stream: ReadableStream): Promise;
}
```
- ```ts
type Adler32AcceptDataType = string | BigUint64Array | Uint8Array | Uint16Array | Uint32Array;
```
> [!NOTE]
> - For the full or prettier documentation, can visit via:
> - [Deno CLI `deno doc`](https://docs.deno.com/runtime/reference/cli/documentation_generator/)
> - [JSR](https://jsr.io/@hugoalh/adler32)
## ๐งฉ CLIs
**Entrypoint:** `cli.js`/`cli.ts`
- From argument; Output hex padding
```ps1
adler32 {Data}
```
- From file; Output hex padding
```ps1
adler32 --file {FilePath}
```
- From stdin; Output hex padding
```ps1
adler32 --stdin
```
## โ๏ธ Examples
- ```ts
new Adler32("Wikipedia").hashHexPadding();
//=> "11E60398"
```