Wednesday, 3 May 2017

check file size returns error:Path must be a string without null bytes when check file size

I am trying to check the size of file using file-system package in express js but i will get the following error

Path must be a string without null bytes when check file size

fs.stat(req.files.image.data, function(err, stat) {
            if(err) {
                // handle error
                console.log(err)
            }
            console.log(stat);
        });

However req.files.image returns correct ouptut.

> { name: 'Clocktower_Panorama_20080622_20mb (1).jpg',   data: <Buffer
> ff d8 ff e0 00 10 4a 46 49 46 00 01 01 01 00 48 00 48 00 00 ff e1 00
> 80 45 78 69 66 00 00 4d 4d 00 2a 00 00 00 08 00 05 01 12 00 03 00 00
> 00 01 00 01 ... >,   encoding: '7bit',   mimetype: 'image/jpeg',   mv:
> [Function: mv] }



via Jabaa

No comments:

Post a Comment