Skip to content

Commit

Permalink
chore: modernize module (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
lino-levan committed Nov 11, 2023
1 parent f210932 commit 62e8f05
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 158 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
uses: actions/checkout@v2

- name: Setup latest deno version
uses: denolib/setup-deno@v2
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Run deno fmt
run: deno fmt --check

- name: Run deno lint
run: deno lint --unstable
run: deno lint

- name: Run deno test
run: deno test
run: deno task test
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog],
and this project adheres to [Semantic Versioning].
The format is based on [Keep a Changelog], and this project adheres to
[Semantic Versioning].

## [0.1.2] - 2020-08-30

Expand Down
109 changes: 35 additions & 74 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ crate-type = ["cdylib"]

[dependencies]
lz4-compression = "0.7.0"
wasm-bindgen = "0.2.67"
wee_alloc = { version = "0.4.5", optional = true }
wasm-bindgen = "0.2.88"

[profile.release]
lto = true
Expand Down
90 changes: 48 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
# deno_lz4

[![stars](https://img.shields.io/github/stars/denosaurs/deno_lz4)](https://github.com/denosaurs/deno_lz4/stargazers)
[![workflow](https://img.shields.io/github/workflow/status/denosaurs/deno_lz4/ci)](https://github.com/denosaurs/deno_lz4/actions)
[![releases](https://img.shields.io/github/v/release/denosaurs/deno_lz4)](https://github.com/denosaurs/deno_lz4/releases/latest/)
[![deno version](https://img.shields.io/badge/deno-^1.0.2-informational)](https://github.com/denoland/deno)
[![deno doc](https://img.shields.io/badge/deno-doc-informational)](https://doc.deno.land/https/deno.land/x/deno_lz4/mod.ts)
[![Discord](https://img.shields.io/discord/713043818806509608)](https://discord.gg/shHG8vg)
[![license](https://img.shields.io/github/license/denosaurs/deno_lz4)](https://github.com/denosaurs/deno_lz4/blob/master/LICENSE)
[![issues](https://img.shields.io/github/issues/denosaurs/deno_lz4)](https://github.com/denosaurs/deno_lz4/issues)

This module provides [lz4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)) support for deno and the web by providing [simple bindings](src/lib.rs) using [lz4-compression](https://github.com/johannesvollmer/lz4-compression-rs) compiled to webassembly.

## Usage

### Compression

```ts
import { compress } from "https://deno.land/x/lz4/mod.ts";
const text = new TextEncoder().encode("X".repeat(64));
console.log(text.length); // 64 Bytes
console.log(compress(text).length); // 6 Bytes
```

### Decompression

```ts
import { decompress } from "https://deno.land/x/lz4/mod.ts";
const compressed = Uint8Array.from([ 31, 88, 1, 0, 44, 0 ]);
console.log(compressed.length); // 6 Bytes
console.log(decompress(compressed).length); // 64 Bytes
```

## Other

### Contribution

Pull request, issues and feedback are very welcome. Code style is formatted with `deno fmt` and commit messages are done following [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec.

### Licence

Copyright 2020-present, the denosaurs team. All rights reserved. MIT license.
# deno_lz4

[![stars](https://img.shields.io/github/stars/denosaurs/deno_lz4)](https://github.com/denosaurs/deno_lz4/stargazers)
[![workflow](https://img.shields.io/github/actions/workflow/status/denosaurs/deno_lz4/checks.yml?branch=master)](https://github.com/denosaurs/deno_lz4/actions)
[![releases](https://img.shields.io/github/v/release/denosaurs/deno_lz4)](https://github.com/denosaurs/deno_lz4/releases/latest/)
[![deno version](https://img.shields.io/badge/deno-^1.0.2-informational)](https://github.com/denoland/deno)
[![deno doc](https://img.shields.io/badge/deno-doc-informational)](https://doc.deno.land/https/deno.land/x/deno_lz4/mod.ts)
[![Discord](https://img.shields.io/discord/713043818806509608)](https://discord.gg/shHG8vg)
[![license](https://img.shields.io/github/license/denosaurs/deno_lz4)](https://github.com/denosaurs/deno_lz4/blob/master/LICENSE)
[![issues](https://img.shields.io/github/issues/denosaurs/deno_lz4)](https://github.com/denosaurs/deno_lz4/issues)

This module provides
[lz4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)) support for
deno and the web by providing [simple bindings](src/lib.rs) using
[lz4-compression](https://github.com/johannesvollmer/lz4-compression-rs)
compiled to webassembly.

## Usage

### Compression

```ts
import { compress } from "https://deno.land/x/lz4/mod.ts";
const text = new TextEncoder().encode("X".repeat(64));
console.log(text.length); // 64 Bytes
console.log(compress(text).length); // 6 Bytes
```

### Decompression

```ts
import { decompress } from "https://deno.land/x/lz4/mod.ts";
const compressed = Uint8Array.from([31, 88, 1, 0, 44, 0]);
console.log(compressed.length); // 6 Bytes
console.log(decompress(compressed).length); // 64 Bytes
```

## Other

### Contribution

Pull request, issues and feedback are very welcome. Code style is formatted with
`deno fmt` and commit messages are done following
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec.

### Licence

Copyright 2020-present, the denosaurs team. All rights reserved. MIT license.
7 changes: 7 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tasks": {
"test": "deno test",
"build": "deno run -A ./scripts/build.ts"
},
"lock": false
}
6 changes: 1 addition & 5 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright 2020-present the denosaurs team. All rights reserved. MIT license.

import init, {
source,
lz4_compress,
lz4_decompress,
} from "./wasm.js";
import init, { lz4_compress, lz4_decompress, source } from "./wasm.js";

await init(source);

Expand Down
Loading

0 comments on commit 62e8f05

Please sign in to comment.