Back to packages list

Vals using lz-string

Description from the NPM package:
LZ-based compression algorithm
1
2
3
4
5
6
7
8
9
10
11
12
13
import { nodeJS_dist } from "https://esm.town/v/stevekrouse/nodeJS_dist";
import LZString from "npm:lz-string";
export async function nodeJSDist(req: Request): Promise<Response> {
let url = new URL(req.url);
if (url.pathname === "/index.tab") {
return new Response(LZString.decompress(nodeJS_dist));
} else if (url.pathname === "/index.json") {
return new Response("Coming soon...");
} else {
return new Response("Not found", { status: 404 });
}
}
1
2
3
4
5
6
7
8
9
10
11
12
import { set } from "https://esm.town/v/std/set";
import LZString from "npm:lz-string";
const name = "nodeJS_dist";
const url = "https://nodejs.org/dist/index.tab";
export async function pollNodeJS(interval: Interval) {
let resp = await fetch(url);
if (!resp.ok) return;
let text = await resp.text();
return await set(name, LZString.compress(text));
}
1
Next