Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildHeader(features: any, header: HeaderMeta) {
const length = features.length
const builder = new flatbuffers.Builder(0)
let columnOffsets = null
if (header.columns)
columnOffsets = Header.createColumnsVector(builder,
header.columns.map(c => buildColumn(builder, c)))
const nameOffset = builder.createString('L1')
Header.start(builder)
Header.addFeaturesCount(builder, new flatbuffers.Long(length, 0))
Header.addGeometryType(builder, header.geometryType)
Header.addIndexNodeSize(builder, 0)
if (columnOffsets)
Header.addColumns(builder, columnOffsets)
Header.addName(builder, nameOffset)
const offset = Header.end(builder)
builder.finishSizePrefixed(offset)
return builder.asUint8Array()
}
function buildHeader(featurecollection: IGeoJsonFeatureCollection, header: HeaderMeta) {
const length = featurecollection.features.length
const builder = new flatbuffers.Builder(0)
let columnOffsets = null
if (header.columns)
columnOffsets = Header.createColumnsVector(builder,
header.columns.map(c => buildColumn(builder, c)))
const nameOffset = builder.createString('L1')
Header.start(builder)
Header.addFeaturesCount(builder, new flatbuffers.Long(length, 0))
Header.addGeometryType(builder, header.geometryType)
Header.addIndexNodeSize(builder, 0)
if (columnOffsets)
Header.addColumns(builder, columnOffsets)
Header.addName(builder, nameOffset)
const offset = Header.end(builder)
builder.finishSizePrefixed(offset)
return builder.asUint8Array()
}