MCPcopy Create free account
hub / github.com/github/docs / writeIndexRecords

Function writeIndexRecords

script/search/search-index-records.js:7–17  ·  view source on GitHub ↗
(name, records, outDirectory)

Source from the content-addressed store, hash-verified

5import validateRecords from './validate-records.js'
6
7export async function writeIndexRecords(name, records, outDirectory) {
8 validateRecords(name, records)
9
10 const recordsObject = Object.fromEntries(records.map((record) => [record.objectID, record]))
11 const content = JSON.stringify(recordsObject, undefined, 0)
12
13 const filePath = path.join(outDirectory, `${name}-records.json`)
14 await fs.writeFile(filePath, content)
15
16 return filePath
17}

Callers 1

syncSearchIndexesFunction · 0.90

Calls 1

validateRecordsFunction · 0.85

Tested by

no test coverage detected