ZWSP
Store data using zero width spaces! Might be useful for discord bots.
Installation
npm i zwsp
Usage
Import the library:
import { encode, decode} from 'zwsp'; // typescript
const { encode, decode } = require('zwsp'); // node.js
Encoding:
encode("Hello World!");
encode(3.14159265359);
encode(12345678987654321n);
encode([ 123, "Hello", 321, "World" ]);
encode({ a: 123, b: 321, c: "example", d: [ "Hello", "world" ] });
Decoding:
decode(...);
// will also keep the type:
decode(encode("123")); // "123" (string)
decode(encode(123)); // 123 (number)
decode(encode([1, 2, 3])); // [1, 2, 3] (object)
Why?
tbh, I don't really know. This might be useful for discord bots that don't use any database but still need to store certain information (for example, bots hosted on heroku).
That was just a random idea that came to my mind at 3 am lol.
It works because the characters this library uses are actually a zero-width spaces and are invisible. Users still can access the info you stored, but a regular user won't notice anything.
Other examples
Visit examples directory for other examples (with discord.js)