modern-netcdf
Version:
Modern NetCDF file reader and utilities
24 lines (21 loc) • 453 B
JavaScript
function notNetcdf(statement, reason) {
if (statement) {
throw new TypeError(`Not a valid NetCDF v3.x file: ${reason}`);
}
}
function padding(buffer) {
if (buffer.offset % 4 !== 0) {
buffer.skip(4 - (buffer.offset % 4));
}
}
function readName(buffer) {
const nameLength = buffer.readUint32();
const name = buffer.readChars(nameLength);
padding(buffer);
return name;
}
module.exports = {
notNetcdf,
padding,
readName,
};