file-bytes
Get the file size of a file
Install
npm install --save file-bytes
Usage
const fileBytes = ; ;//=> "README.md" is 1806 bytes // syncconsole;//=> "README.md" is 1806 bytes
API
fileBytes(filename)
Returns a promise for the filename's file size as a number
.
fileBytes.sync(filename)
Return's the filename's file size as a number
.
filename
Type: string
Examples
- Convert the output into human style using pretty-bytes
const fileBytes = ;const prettyBytes = ; console;//=> 1.34 kB
- Get the file sizes of everything in the current repo with glob
const fileBytes = ;const glob = ; ;//=> "README.md" is 1806 bytes//=> "package.json" is 122 bytes//=> "index.js" is 497 bytes
License
MIT © Dawson Botsford