function convertToMap(input, path = '') {
  /** @type {Record<string, any>} */
  let result = {}

  if (Array.isArray(input)) {
    if (input[2] instanceof Uint8Array) {
      // Convert Uint8Array to string with utf8 encoding
      let decoder = new TextDecoder('utf8')
      let stringValue = decoder.decode(input[2])
      result[path] = stringValue
    } else if (typeof input[2] === 'object') {
      // Recursively process nested objects
      for (let key in input[2]) {
        let nestedResult = convertToMap(input[2][key], path + '/' + key)
        result = { ...result, ...nestedResult }
      }
    }
  }

  return result
}
Convert a memfs snapshot to a map

@param {import('memfs/lib/snapshot').SnapshotNode} input
@param {string} [path]
@returns {Record<string, any>}