(packFile: NewPackedFile)
| 2314 | return Buffer.concat(buffers); |
| 2315 | }; |
| 2316 | const ensurePackFileReadyForWrite = (packFile: NewPackedFile): NewPackedFile => { |
| 2317 | if (packFile.buffer) { |
| 2318 | if (packFile.file_size == null) { |
| 2319 | packFile.file_size = packFile.buffer.length; |
| 2320 | } |
| 2321 | return packFile; |
| 2322 | } |
| 2323 | if (packFile.file_size != null) { |
| 2324 | return packFile; |
| 2325 | } |
| 2326 | if (!packFile.schemaFields || !packFile.tableSchema) { |
| 2327 | throw new Error(`Pack file "${packFile.name}" is missing file_size and cannot be serialized`); |
| 2328 | } |
| 2329 | const buffer = serializePackFileDataToBuffer(packFile); |
| 2330 | packFile.buffer = buffer; |
| 2331 | packFile.file_size = buffer.length; |
| 2332 | return packFile; |
| 2333 | }; |
| 2334 | const ensurePackFilesReadyForWrite = (packFiles: NewPackedFile[]): NewPackedFile[] => { |
| 2335 | for (const packFile of packFiles) { |
| 2336 | ensurePackFileReadyForWrite(packFile); |
no test coverage detected