Nodejs file not working

When someone visits a url, I want that page to show their disk storage info as an object like this:

{"total":"510 GB","used":"298 GB","left":"212 GB","percentage":"58%"}

For that I’m using an npm package called node-disk-info.

When I type node start.js it works correctly on my device.
But when I deployed it to Heroku, it’s not working.
Does anyone know why this is happening?
Is it really possible? Can you get someone’s storage info like that?
I’m really new to this backend stuff. If anyone could help me that’d be very much appreciated.
It’s only a single JS file with only 36 lines of code.

Here’s the Repo Link: GitHub - FarisPalayi/storage: trying to get user device storage info.
Heroku link: https://user-storage-detect.herokuapp.com/getStorage.

1 Like

Stop and think about this logically. Do you really think that this program is running on the user’s computer? Or is it always running on one specific computer (possibly the one you are deploying it to?) that isn’t ever their computer? If it’s the latter, how would the program be able to jump down a network connection into the user’s computer to take a look at its storage?

1 Like

I thought you could do that somehow :grinning_face_with_smiling_eyes:.
But, I was not sure if you could do that, that’s why I asked this :point_down:

It’s a dumb mistake I know. But, on the bright side, now I know you can’t do that.
And thanks for that! :blush:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.