1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00
onion/js/utils/file.js
2016-07-08 18:39:47 +02:00

19 lines
588 B
JavaScript

// Re-export related utilities from js-utility-belt for easier access
export {
createTextFile,
computeFileHash,
extractFileExtensionFromString,
extractFileExtensionFromUrl
} from 'js-utility-belt/es6/file';
/**
* Transforms kb size to mb size, using an arbitrary rounding function at the end.
*
* @param {number} size Size in kb
* @param {function} roundFn Function to round out the precise size in mb, defaulting to Math.ceil.
* @return {number} Size in mb
*/
export function kbToMb(size, roundFn = Math.ceil) {
return roundFn(size / 1024);
}