You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
906 B
JavaScript

'use strict';
const createBufferReader = require("../buffer-reader");
module.exports = function parsePathTableRecord(data, tableType) {
let bufferReader = createBufferReader(data);
let extentLocation, parentDirectoryIndex;
let identifierLength = bufferReader.int8(0);
if (tableType === "L") {
extentLocation = bufferReader.int32_LSB(2);
parentDirectoryIndex = bufferReader.int16_LSB(6);
} else if (tableType === "M") {
extentLocation = bufferReader.int32_MSB(2);
parentDirectoryIndex = bufferReader.int16_MSB(6);
} else {
throw new Error("Unknown path table type");
}
return {
identifierLength: identifierLength,
earLength: bufferReader.int8(1),
extentLocation: extentLocation,
parentDirectoryIndex: parentDirectoryIndex,
identifier: bufferReader.strFilename(8, identifierLength)
}
};