Skip to content

Commit

Permalink
Merge pull request #14 from DIG-Network/release/v0.0.1-alpha.14
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.14
  • Loading branch information
MichaelTaylor3D authored Sep 10, 2024
2 parents f57b8ad + b75c9fe commit 119cede
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.1-alpha.14](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.10...v0.0.1-alpha.14) (2024-09-10)


### Features

* add plimit to directory add ([468cff2](https://github.com/DIG-Network/dig-chia-sdk/commit/468cff28397c993b22af7388a8472b1d2068aebd))

### [0.0.1-alpha.13](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.10...v0.0.1-alpha.13) (2024-09-10)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dignetwork/dig-sdk",
"version": "0.0.1-alpha.13",
"version": "0.0.1-alpha.14",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
24 changes: 24 additions & 0 deletions src/utils/directoryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,27 @@ export const addDirectory = async (
// Run tasks with limited concurrency (set the concurrency limit as needed)
await limitConcurrency(10, tasks); // Adjust 10 based on your system limits
};

/**
* Calculate the total size of the DIG_FOLDER_PATH
* @param folderPath - The path of the folder to calculate size.
* @returns The total size of the folder in bytes.
*/
export const calculateFolderSize = (folderPath: string): bigint => {
let totalSize = BigInt(0);

const files = fs.readdirSync(folderPath);

for (const file of files) {
const filePath = path.join(folderPath, file);
const stat = fs.statSync(filePath);

if (stat.isDirectory()) {
totalSize += calculateFolderSize(filePath);
} else {
totalSize += BigInt(stat.size);
}
}

return totalSize;
};

0 comments on commit 119cede

Please sign in to comment.