Skip to main content
sunilg33
Known Participant
March 28, 2019
Answered

How can i get file size using cep

  • March 28, 2019
  • 2 replies
  • 1710 views

Hi, i'm trying to get file size with cep

i did not figure out api in cep to get filesize.


here is what i have tried:

var path = 'E:\\inbox\\log.txt';

var statObj = window.cep.fs.stat(path);

// statObj does not contain file size .

How can i get file size?



.

This topic has been closed for replies.
Correct answer tomzag

I don't think it's natively supported on the javascript side.

You can use node.js or on the jsx file:

var file = new File("<pathToYourFile>");

var fileSize = file.length;

2 replies

tomzag
tomzagCorrect answer
Inspiring
March 29, 2019

I don't think it's natively supported on the javascript side.

You can use node.js or on the jsx file:

var file = new File("<pathToYourFile>");

var fileSize = file.length;

sunilg33
sunilg33Author
Known Participant
March 29, 2019

thanks tomzag​   for your help.

it works for filesize.

but i want folder size too. above code is failing.  Question: how to get folder size

tomzag
Inspiring
March 29, 2019

I think you have to iterate (best will be recursive) through the files.

Of course, if there are a lot of files it can take some time.

Community Expert
March 28, 2019

Moving the discussion to the Extensions / Add-ons Development forum for more relevant responses.

-Manan

-Manan
sunilg33
sunilg33Author
Known Participant
March 29, 2019

thanks for your reply and moving to Extensions / Add-ons Development