File Size

The file-size helper can be used to determine the length of a file; combined with the bytes helper is can be used to show the size of a file offered for download.

If an absolute path is given it is resolved relative to the site directory; the argument may be a raw path or a quoted string.

Arguments

Example

Print the number of bytes in index.md:

{{file-size /index.md}}

Renders as:

2671

Combine this with the bytes helper for a human friendly file size:

{{bytes (file-size /index.md)}}

Renders as:

2.6 KB

Back to Helpers