Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bytes-to-co2

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bytes-to-co2

Javascript module that calculates the co2 generated in transfer x amount of bytes over the network and the country.

  • 0.2.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28
decreased by-34.88%
Maintainers
1
Weekly downloads
 
Created
Source

bytes-to-co2

Calculate the co2 footprint (carbon dioxide released to the atmosphere) of transmitting an x amount of bytes over the internet.

Transport data over the internet requires energy (datacenters, repeaters, switches, etc) and how this energy is different from country to country. This is known as the "co2 emission intensity". Each country have different ways to produce electricity (solar, wind, coal, diesel, nuclear, etc) and each one of these releases to the atmosphere a different amount of Carbon Dioxide (co2), therefore transmit x amount of data will release a y amount of co2.

This module has the information of the European energy grid from 1990 to 2016. More countries will be added later.

Usage

Install the package using yarn add bytes-to-co2 or npm install bytes-to-co2

Import the library and call the function as shown:

import { byteToCo2 } from "bytes-to-co2";

//Only with asset size
const europeanUnion = byteToCo2({ byteSize: 1000000 }); // 0.4972508177161217
const uk = byteToCo2({ byteSize: 1000000, country: 'United Kingdom' }); // 0.47253957018256193
const sweden = byteToCo2({ byteSize: 1000000, country: 'Sweden' }); // 0.022357795387506485
const spain = byteToCo2({ byteSize: 1000000, country: 'Spain' }); // 0.4461472854018211

Contributing

If anything in the way I'm calculating the footprint looks odd to you, please feel free to open an issue or PR. Any feedback or improvements in the way the co2 is calculated is welcomed.

Keywords

FAQs

Package last updated on 13 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc