Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jduncanator/node-diskusage
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: hola/node-diskusage
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 7 commits
  • 5 files changed
  • 2 contributors

Commits on Jun 5, 2018

  1. Copy the full SHA
    2442bbc View commit details
  2. bump version

    dyatlov committed Jun 5, 2018
    Copy the full SHA
    cacd0ad View commit details

Commits on Nov 1, 2021

  1. Merge upstream

    SirAnthony committed Nov 1, 2021
    Copy the full SHA
    c1046db View commit details
  2. Copy the full SHA
    f8fe8c3 View commit details
  3. Merge

    SirAnthony committed Nov 1, 2021
    Copy the full SHA
    d515d19 View commit details
  4. Copy the full SHA
    4685624 View commit details

Commits on Jan 23, 2024

  1. split to separate scope

    SirAnthony committed Jan 23, 2024
    Copy the full SHA
    5fea06a View commit details
Showing with 14 additions and 5 deletions.
  1. +2 −2 package.json
  2. +3 −0 src/diskusage.h
  3. +3 −1 src/diskusage_posix.cpp
  4. +3 −1 src/diskusage_win.cpp
  5. +3 −1 src/main.cpp
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "diskusage",
"version": "1.1.3",
"name": "@hola.org/diskusage",
"version": "1.1.3-hola.1",
"description": "Get total diskspace and free diskspace using bindings around platform specific calls.",
"main": "index.js",
"typings": "index.d.ts",
3 changes: 3 additions & 0 deletions src/diskusage.h
Original file line number Diff line number Diff line change
@@ -26,6 +26,9 @@ struct DiskUsage {
uint64_t available;
uint64_t free;
uint64_t total;
uint64_t inodes_available;
uint64_t inodes_free;
uint64_t inodes_total;
};

DiskUsage GetDiskUsage(const char* path);
4 changes: 3 additions & 1 deletion src/diskusage_posix.cpp
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@ DiskUsage GetDiskUsage(const char* path)
result.available = info.f_bavail * info.f_frsize;
result.free = info.f_bfree * info.f_frsize;
result.total = info.f_blocks * info.f_frsize;

result.inodes_available = info.f_favail;
result.inodes_free = info.f_ffree;
result.inodes_total = info.f_files;
return result;
}
4 changes: 3 additions & 1 deletion src/diskusage_win.cpp
Original file line number Diff line number Diff line change
@@ -59,6 +59,8 @@ DiskUsage GetDiskUsage(const char* path)
result.available = available.QuadPart;
result.free = free.QuadPart;
result.total = total.QuadPart;

result.inodes_available = 0;
result.inodes_free = 0;
result.inodes_total = 0;
return result;
}
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -9,7 +9,9 @@ static v8::Local<v8::Object> ConvertDiskUsage(const DiskUsage& usage)
Nan::Set(obj, Nan::New<v8::String>("available").ToLocalChecked(), Nan::New<v8::Number>(static_cast<double>(usage.available)));
Nan::Set(obj, Nan::New<v8::String>("free").ToLocalChecked(), Nan::New<v8::Number>(static_cast<double>(usage.free)));
Nan::Set(obj, Nan::New<v8::String>("total").ToLocalChecked(), Nan::New<v8::Number>(static_cast<double>(usage.total)));

Nan::Set(obj, Nan::New<v8::String>("inodes_available").ToLocalChecked(), Nan::New<v8::Number>(static_cast<double>(usage.inodes_available)));
Nan::Set(obj, Nan::New<v8::String>("inodes_free").ToLocalChecked(), Nan::New<v8::Number>(static_cast<double>(usage.inodes_free)));
Nan::Set(obj, Nan::New<v8::String>("inodes_total").ToLocalChecked(), Nan::New<v8::Number>(static_cast<double>(usage.inodes_total)));
return obj;
}