Latest version sourcehut GitHub mirror

wcarbon

Access Website Carbon’s API for checking carbon emissions for websites.

Usage

Example for site

import { site } from "https://deno.land/x/wcarbon/mod.ts";

const siteUrl = "example.org";
const result = site(siteUrl);

Example for data

import { data } from "https://deno.land/x/wcarbon/mod.ts";

const result = data({ bytes: 1024, hasGreenHosting: false });

CLI

Installation

deno install --allow-net=api.websitecarbon.com \
   -n wcarbon https://deno.land/x/wcarbon/src/cli.ts

Usage

$ wcarbon timharek.no
$ wcarbon site timharek.no
$ wcarbon data 2048
$ wcarbon -h # for all available flags and commands

Development

  1. Install Deno
  2. Run deno task setup:hooks
  3. Now you can get to work! 🕶️