Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve disk information #2386

Closed
sagitsofan opened this issue Jul 23, 2019 · 3 comments · Fixed by #2396
Closed

Retrieve disk information #2386

sagitsofan opened this issue Jul 23, 2019 · 3 comments · Fixed by #2396

Comments

@sagitsofan
Copy link

sagitsofan commented Jul 23, 2019

  • Version: v1.30.1
  • Platform: Both

Inside Node there is no api to get the disk information, for example: total, used & available storage on a specific disk.

We would like that in Libuv you will add this feature, and in Node we will expose it inside the fs api - https://nodejs.org/api/fs.html
Desirable implementation code on Node:

const diskInfo = fs.diskInfoSync("C:")

diskInfo.total - disk total size.
diskInfo.used - how much of the drive is used.
diskInfo.available - how much free space have left.

nodejs/node#10745

@cjihrig
Copy link
Contributor

cjihrig commented Jul 25, 2019

@libuv/collaborators what do you think? The original request from Node is for something like statvfs(3). If we implement it in libuv, I believe it will be a little different because of Windows. If we want to add it to libuv, I'm OK with doing the work.

@bnoordhuis
Copy link
Member

I'm okay with adding it. One issue I see is that available on file systems supporting compression might be meaningless but that's not really a libuv issue if the data comes directly from the operating system.

You probably want statfs(2) instead of statvfs(3), the latter doesn't report all the relevant data.

@saghul
Copy link
Member

saghul commented Jul 28, 2019

+1. I guess we can have some uv_statfs_t which we fill-in as we can (on Windows specially).

cjihrig added a commit to cjihrig/libuv that referenced this issue Aug 1, 2019
Fixes: libuv#2386
PR-URL: libuv#2396
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants