Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/wcarbon/src/wcarbon.ts>data

Access Website Carbon's API for checking carbon emissions for websites with Deno.
Latest
function data
import { data } from "https://deno.land/x/wcarbon@v3.0.4/src/wcarbon.ts";

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

Examples

Example for data

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

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

Parameters

unnamed 0: DataRequest

Takes in both bytes and hasGreenHosting args to calculate the emissions.

Returns

Promise<DataResponse | null>