FileSizePlugin
Extends:
A Broccoli plugin that display sizes of all files found in its input path.
Constructor Summary
Public Constructor | ||
public |
constructor(inputNodes: Node | Node[], options: Object) Create a new FileSizePlugin instances |
Method Summary
Public Methods | ||
public |
Builds this node. |
|
public |
Lists files of a directory recursively. |
|
public |
Prints calculated sizes |
|
public |
processFile(absolutePath: String): Promise Either reads the given file's contents and calculating its gzipped sie
(when |
|
public |
symlinkOrCopy(dir: String, target: String) Symlink or copy a directory |
Public Constructors
Public Members
Public Methods
public build(): Promise source
Builds this node.
Symlinks the first input path to this node's output path, then look for all files in the input path, and process each of them by either:
- reading the file's contents and calculating its gzipped sie (when
gzipped
options istrue
) - or, stating the file (if
gzipped
option isfalse
). Then, display size(s) on standard output.
Return:
Promise | A new Promise that is resolved once all input files have been processed, and sizes have been displayed. Alternatively, it can be rejected in case of errors. |
public listFiles(dir: String, callback: Function): Promise source
Lists files of a directory recursively. Follows symbolic links.
Return:
Promise | A new promise that is resolved once the given directory has been scanned entirely and all callbacks have completed. |
public print(relativePath: String, size: Number], gzippedSize: Number) source
Prints calculated sizes
public processFile(absolutePath: String): Promise source
Either reads the given file's contents and calculating its gzipped sie
(when gzipped
options is true
), or stats the given file
(if gzipped
option is false
).
Params:
Name | Type | Attribute | Description |
absolutePath | String | Absolute path to the file |
Return:
Promise | A new Promise that is resolved when file has been processed. The resolved value is an array containing the file size and the gzipped file size (or undefined) |