Skip to main content
Module

x/wcarbon/mod.ts

Access Website Carbon's API for checking carbon emissions for websites with Deno.
Latest
import * as wcarbon from "https://deno.land/x/wcarbon@v3.0.4/mod.ts";

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

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: true});

Install CLI

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

Functions

Calculate the emissions of a page by manually passing the bytes and whether or not it is powered by green hosting.

Calculate the carbon emissions generated per page view.