async function _packObjects({ fs, cache, gitdir, oids, write }) {
  const buffers = await _pack({ fs, cache, gitdir, oids })
  const packfile = Buffer.from(await collect(buffers))
  const packfileSha = packfile.slice(-20).toString('hex')
  const filename = `pack-${packfileSha}.pack`
  if (write) {
    await fs.write(join(gitdir, `objects/pack/${filename}`), packfile)
    return { filename }
  }
  return {
    filename,
    packfile: new Uint8Array(packfile),
  }
}
@param {object} args
@param {import('../models/FileSystem.js').FileSystem} args.fs
@param {any} args.cache
@param {string} args.gitdir
@param {string[]} args.oids
@param {boolean} args.write

@returns {Promise<PackObjectsResult>}
@see PackObjectsResult