Latest version sourcehut GitHub mirror

wcarbon

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

Usage

Example for site

import { site } from "jsr:@timharek/wcarbon";

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

Example for data

import { data } from "jsr:@timharek/wcarbon";

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

CLI

Installation

deno install --allow-net=api.websitecarbon.com \
   -n wcarbon jsr:@timharek/wcarbon/cli

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! 😎