Gets the size in a user-friendly format, such as “1.17 GB” or “117 MB”. You can specify the unit of measurement you prefer by providing an options object. The default unit is “auto”. Options: size( type: “auto” | “tb” | “gb” | “mb” | “bytes” )
Show Example
Copy
// Automatically choose the best unitconst sizeAuto = clip.proxy.size();console.log(sizeAuto); // Output: "117 MB"// Specify the unit as Gigabytesconst sizeGB = clip.proxy.size({ type: 'gb' });console.log(sizeGB); // Output: "0.117 GB"
Retrieves the size as a numerical value. This method returns the size in a numerical format, which can be useful for calculations or comparisons.
You can specify the unit of measurement by providing an options object. The default unit is “bytes”. Options: sizeAsNumber( type: “auto” | “tb” | “gb” | “mb” | “bytes” )
Show Example
Copy
// Get size in the default unit (bytes)const sizeNumberDefault = clip.proxy.sizeAsNumber();console.log(sizeNumberDefault); // Output: 117000000// Get size in Gigabytesconst sizeNumberGB = clip.proxy.sizeAsNumber({ type: 'gb' });console.log(sizeNumberGB); // Output: 0.117// Get size in Megabytesconst sizeNumberMB = clip.proxy.sizeAsNumber({ type: 'mb' });console.log(sizeNumberMB); // Output: 117
Obtains the size as a pair containing both the numerical value and its unit. This method returns an array where the first element is the size number and the second element is the unit.
You can specify the unit of measurement by providing an options object. The default unit is “auto”. Options: sizeAsTuple( type: “auto” | “tb” | “gb” | “mb” | “bytes” )
Show Example
Copy
// Get size as a tuple with automatic unitconst sizeTupleAuto = clip.proxy.sizeAsTuple();console.log(sizeTupleAuto); // Output: [117, 'MB']// Get size as a tuple in Gigabytesconst sizeTupleGB = clip.proxy.sizeAsTuple({ type: 'gb' });console.log(sizeTupleGB); // Output: [0.117, 'GB']
Gets the size in a user-friendly format, such as “1.17 GB” or “117 MB”.
You can specify the unit of measurement you prefer by providing an options object.
The default unit is auto, which automatically selects the most appropriate unit. Options: size( type: “auto” | “tb” | “gb” | “mb” | “bytes” )
Show Example
Copy
// Automatically choose the best unitconst sizeAuto = log.ocf.size();console.log(sizeAuto); // Output: "117 MB"// Specify the unit as Gigabytesconst sizeGB = log.ocf.size({ type: 'gb' });console.log(sizeGB); // Output: "0.117 GB"
Retrieves the size as a numerical value.
This method returns the size in a numerical format, which can be useful for calculations or comparisons.
You can specify the unit of measurement by providing an options object. The default unit is bytes. Options: sizeAsNumber( type: “auto” | “tb” | “gb” | “mb” | “bytes” )
Show Example
Copy
// Get size in the default unit (bytes)const sizeNumberDefault = log.ocf.sizeAsNumber();console.log(sizeNumberDefault); // Output: 117000000// Get size in Gigabytesconst sizeNumberGB = log.ocf.sizeAsNumber({ type: 'gb' });console.log(sizeNumberGB); // Output: 0.117// Get size in Megabytesconst sizeNumberMB = log.ocf.sizeAsNumber({ type: 'mb' });console.log(sizeNumberMB); // Output: 117
Obtains the size as a pair containing both the numerical value and its unit. This method returns an array where the first element is the size number and the second element is the unit.
You can specify the unit of measurement by providing an options object. The default unit is “auto”. Options: sizeAsTuple( type: “auto” | “tb” | “gb” | “mb” | “bytes” )
Show Example
Copy
// Get size as a tuple with automatic unitconst sizeTupleAuto = log.ocf.sizeAsTuple();console.log(sizeTupleAuto); // Output: [117, 'MB']// Get size as a tuple in Gigabytesconst sizeTupleGB = log.ocf.sizeAsTuple({ type: 'gb' });console.log(sizeTupleGB); // Output: [0.117, 'GB']