Last active
September 21, 2021 19:12
-
-
Save dillansimmons/4b57628bcf014a80ec5818f515a605b8 to your computer and use it in GitHub Desktop.
Calculate cost to upload folder in ETH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-console */ | |
import getFolderSize from 'get-folder-size'; | |
async function checkCost() { | |
const myFolder = 'dist'; // your prod assets folder: can be folder or zip file | |
const size = await getFolderSize.loose(myFolder); | |
console.log(`The project is ${size} bytes large`); | |
console.log(`Cost: ${675 * size * 10 * (1 / 1000000000)}Eth at 10Gwei`); | |
console.log(`Cost: ${675 * size * 50 * (1 / 1000000000)}Eth at 50Gwei`); | |
console.log(`Cost: ${675 * size * 100 * (1 / 1000000000)}Eth at 100Gwei`); | |
console.log(`Cost: ${675 * size * 150 * (1 / 1000000000)}Eth at 150Gwei`); | |
console.log(`Cost: ${675 * size * 200 * (1 / 1000000000)}Eth at 200Gwei`); | |
} | |
checkCost(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "mcok project package.json file", | |
... | |
"scripts": { | |
"cost": "node cost.mjs", | |
}, | |
... | |
"devDependencies": { | |
"get-folder-size": "^3.1.0", | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment