js-cfb/bits/42_sectorify.js
SheetJS 5c7df1f3db version bump 0.10.0: performance
- reworked IIFE
- avoid Buffer read helpers (see https://github.com/joyent/node/issues/7809)
- avoid nested functions in parse
- eliminate consecutive nulls in test files (libreoffice)
- travis + coveralls support
- jscs linting
2014-06-24 00:00:39 -04:00

10 lines
298 B
JavaScript

/** Break the file up into sectors */
function sectorify(file, ssz) {
var nsectors = Math.ceil(file.length/ssz)-1;
var sectors = new Array(nsectors);
for(var i=1; i < nsectors; ++i) sectors[i-1] = file.slice(i*ssz,(i+1)*ssz);
sectors[nsectors-1] = file.slice(nsectors*ssz);
return sectors;
}