Newer
Older
Florent
committed
export function fileConvertSize(aSize){
aSize = Math.abs(parseInt(aSize, 10));
const def = [[1, 'octets', 0], [1024, 'ko', 0], [1024*1024, 'Mo', 1], [1024*1024*1024, 'Go', 2], [1024*1024*1024*1024, 'To', 2]];
for (let i=0; i<def.length; i++) {
if (aSize<def[i][0]) {
return (aSize/def[i-1][0]).toFixed(def[i-1][2]) + ' ' + def[i-1][1];
}
Florent
committed
}
export function fileConvertSizeToMo(aSize){
aSize = Math.abs(parseInt(aSize, 10));
const def = [1024*1024, 'Mo', 1];
return (aSize/def[0]).toFixed(def[2]);
Florent
committed
}
const headers = allLines[0].split(delimiter).map(el => {
return el.replace('\r', '');
});
const [, ...lines] = allLines;
for (const line of lines) {