Skip to content

Commit

Permalink
fix(readme): update for separate package
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Nelson committed Nov 9, 2019
1 parent d7c32e4 commit 3d3c46c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Decode lavaplayer tracks locally, from a Buffer or base64 string.
# Installation

```
npm i lavaplayer-track-info
npm i @lavalink/encoding
```

# Usage

```js
const { decodeTrack } = require("lavaplayer-track-info");
```ts
import { decode } from "@lavalink/encoding";

const track = "QAAAkwIANFNrcmlsbGV4ICYgSGFic3RyYWt0IC0gQ2hpY2tlbiBTb3VwIFtPZmZpY2lhbCBBdWRpb10ABU9XU0xBAAAAAAADLIAACzIyTVdyV1BWX1FNAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9MjJNV3JXUFZfUU0AB3lvdXR1YmUAAAAAAAAAAA==";

console.log(decodeTrack(track));
console.log(decodeTrack(Buffer.from(track, "base64")));
console.log(decode(track));
console.log(decode(new Uint8Array(Buffer.from(track, "base64"))));
```

Both log
Expand All @@ -36,11 +36,9 @@ Both log
## Encoding tracks

```js
const { encodeTrack, decodeTrack } = require("lavaplayer-track-info");
import { encode, decode } from "lavaplayer-track-info";

const track = "QAAAkwIANFNrcmlsbGV4ICYgSGFic3RyYWt0IC0gQ2hpY2tlbiBTb3VwIFtPZmZpY2lhbCBBdWRpb10ABU9XU0xBAAAAAAADLIAACzIyTVdyV1BWX1FNAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9MjJNV3JXUFZfUU0AB3lvdXR1YmUAAAAAAAAAAA==";

console.log(encodeTrack(decodeTrack(track)).toString("base64") === track);
console.log(encode(decode(track)) === track); // true
```

Logs `true`

0 comments on commit 3d3c46c

Please sign in to comment.