2

I have a vhd (disk) of size 500 MB, of which only 10 MB of data is written, followed by empty chunks and finally one more block of 10 MB towards the end.

So , the total data present is just 20 MB out of 500 MB. I am trying to find a utility in node.js , to find out the number of data bytes, not succeeded though.

There is a function fs.fstatSync(file).size, which gives the total size.

Is there any utility/functions to calculate the data written?

user2630764
  • 624
  • 1
  • 8
  • 19
  • 1
    If you're using a fixed VHD, there's no easy way to calculate that except to parse the partition table and maybe some filesystem structures. – mscdex Oct 12 '14 at 03:14
  • Yes, I am using a fixed vhd only . any reference to any of the articles/blogs available to start off with?I am very new to node.js, in .net there is ready apis available for this ? – user2630764 Oct 12 '14 at 03:35
  • 1
    You could spawn a child process to run a shellscript. Other that that, I don't think node has a way to find out. – xShirase Oct 12 '14 at 05:10

1 Answers1

0

You will probably have to use require("child_process") to access some system utility cli.

erikvold
  • 15,988
  • 11
  • 54
  • 98