lib/footer.js
function( buffer, offset ) {

    offset = offset || 0

    this.signature = buffer.readUInt32BE( offset + 0 )

    if( this.signature !== Footer.signature ) {
      var expected = Footer.signature.toString(16)
      var actual = this.signature.toString(16)
      throw new Error( `Invalid footer signature: Expected 0x${expected}, saw 0x${actual}` )
    }

    this.version = buffer.readUInt32BE( offset + 4 )
    this.headerSize = buffer.readUInt32BE( offset + 8 )
    this.flags = buffer.readUInt32BE( offset + 12 )
    this.runningDataForkOffset = uint64.readBE( buffer, offset + 16, 8 )
    this.dataForkOffset = uint64.readBE( buffer, offset + 24, 8 )
    this.dataForkLength = uint64.readBE( buffer, offset + 32, 8 )
    this.resourceForkOffset = uint64.readBE( buffer, offset + 40, 8 )
    this.resourceForkLength = uint64.readBE( buffer, offset + 48, 8 )
    this.segmentNumber = buffer.readUInt32BE( offset + 56 )
    this.segmentCount = buffer.readUInt32BE( offset + 60 )

    buffer.copy( this.segmentId, 0, offset + 64, offset + 64 + 16 )

    this.dataChecksum.parse( buffer, offset + 80 )

    this.xmlOffset = uint64.readBE( buffer, offset + 216, 8 )
    this.xmlLength = uint64.readBE( buffer, offset + 224, 8 )

    buffer.copy( this.reserved1, 0, offset + 232, offset + 232 + 120 )

    this.checksum.parse( buffer, offset + 352 )

    this.imageVariant = buffer.readUInt32BE( offset + 488 )
    this.sectorCount = uint64.readBE( buffer, offset + 492, 8 )

    this.reserved2 = buffer.readUInt32BE( offset + 500 )
    this.reserved3 = buffer.readUInt32BE( offset + 504 )
    this.reserved4 = buffer.readUInt32BE( offset + 508 )

    return this

  }
function( buffer, offset ) {

    offset = offset || 0

    this.signature = buffer.readUInt32BE( offset + 0 )

    if( this.signature !== Footer.signature ) {
      var expected = Footer.signature.toString(16)
      var actual = this.signature.toString(16)
      throw new Error( `Invalid footer signature: Expected 0x${expected}, saw 0x${actual}` )
    }

    this.version = buffer.readUInt32BE( offset + 4 )
    this.headerSize = buffer.readUInt32BE( offset + 8 )
    this.flags = buffer.readUInt32BE( offset + 12 )
    this.runningDataForkOffset = uint64.readBE( buffer, offset + 16, 8 )
    this.dataForkOffset = uint64.readBE( buffer, offset + 24, 8 )
    this.dataForkLength = uint64.readBE( buffer, offset + 32, 8 )
    this.resourceForkOffset = uint64.readBE( buffer, offset + 40, 8 )
    this.resourceForkLength = uint64.readBE( buffer, offset + 48, 8 )
    this.segmentNumber = buffer.readUInt32BE( offset + 56 )
    this.segmentCount = buffer.readUInt32BE( offset + 60 )

    buffer.copy( this.segmentId, 0, offset + 64, offset + 64 + 16 )

    this.dataChecksum.parse( buffer, offset + 80 )

    this.xmlOffset = uint64.readBE( buffer, offset + 216, 8 )
    this.xmlLength = uint64.readBE( buffer, offset + 224, 8 )

    buffer.copy( this.reserved1, 0, offset + 232, offset + 232 + 120 )

    this.checksum.parse( buffer, offset + 352 )

    this.imageVariant = buffer.readUInt32BE( offset + 488 )
    this.sectorCount = uint64.readBE( buffer, offset + 492, 8 )

    this.reserved2 = buffer.readUInt32BE( offset + 500 )
    this.reserved3 = buffer.readUInt32BE( offset + 504 )
    this.reserved4 = buffer.readUInt32BE( offset + 508 )

    return this

  }
function ( buffer , offset ) { offset = offset || 0 this . signature = buffer . readUInt32BE ( offset + 0 ) if ( this . signature !== Footer . signature ) { var expected = Footer . signature . toString ( 16 ) var actual = this . signature . toString ( 16 ) throw new Error ( ` ${ expected } ${ actual } ` ) } this . version = buffer . readUInt32BE ( offset + 4 ) this . headerSize = buffer . readUInt32BE ( offset + 8 ) this . flags = buffer . readUInt32BE ( offset + 12 ) this . runningDataForkOffset = uint64 . readBE ( buffer , offset + 16 , 8 ) this . dataForkOffset = uint64 . readBE ( buffer , offset + 24 , 8 ) this . dataForkLength = uint64 . readBE ( buffer , offset + 32 , 8 ) this . resourceForkOffset = uint64 . readBE ( buffer , offset + 40 , 8 ) this . resourceForkLength = uint64 . readBE ( buffer , offset + 48 , 8 ) this . segmentNumber = buffer . readUInt32BE ( offset + 56 ) this . segmentCount = buffer . readUInt32BE ( offset + 60 ) buffer . copy ( this . segmentId , 0 , offset + 64 , offset + 64 + 16 ) this . dataChecksum . parse ( buffer , offset + 80 ) this . xmlOffset = uint64 . readBE ( buffer , offset + 216 , 8 ) this . xmlLength = uint64 . readBE ( buffer , offset + 224 , 8 ) buffer . copy ( this . reserved1 , 0 , offset + 232 , offset + 232 + 120 ) this . checksum . parse ( buffer , offset + 352 ) this . imageVariant = buffer . readUInt32BE ( offset + 488 ) this . sectorCount = uint64 . readBE ( buffer , offset + 492 , 8 ) this . reserved2 = buffer . readUInt32BE ( offset + 500 ) this . reserved3 = buffer . readUInt32BE ( offset + 504 ) this . reserved4 = buffer . readUInt32BE ( offset + 508 ) return this }
Parse a Koly block from a buffer
@param {Buffer} buffer
@param {Number} [offset=0]
@returns {Footer}
Parse a Koly block from a buffer