async function processBufferNode({
  buffer,
  hash,
  cache,
  createNode,
  parentNodeId,
  createNodeId,
  ext,
  name,
}) {
  const pluginCacheDir = cache.directory

  // See if there's a cache file for this buffer's contents from
  // a previous run
  let filename = await cache.get(cacheId(hash))
  if (!filename) {
    // If the user did not provide an extension and we couldn't get
    // one from remote file, try and guess one
    if (typeof ext === `undefined`) {
      const filetype = await fileType.fromBuffer(buffer)
      ext = filetype ? `.${filetype.ext}` : `.bin`
    }
    filename = createFilePath(path.join(pluginCacheDir, hash), name, ext)
    await fs.ensureDir(path.dirname(filename))

    // Cache the buffer contents
    await writeBuffer(filename, buffer)

    // Save the cache file path for future use
    await cache.set(cacheId(hash), filename)
  }

  // Create the file node.
  const fileNode = await createFileNode(filename, createNodeId, {})
  fileNode.internal.description = `File "Buffer<${hash}>"`
  fileNode.hash = hash
  fileNode.parent = parentNodeId
  // Override the default plugin as gatsby-source-filesystem needs to
  // be the owner of File nodes or there'll be conflicts if any other
  // File nodes are created through normal usages of
  // gatsby-source-filesystem.
  await createNode(fileNode, { name: `gatsby-source-filesystem` })

  return fileNode
}
processBufferNode
--
Write the buffer contents out to disk and return the fileNode

@param {CreateFileNodeFromBufferPayload} options
@return {Promise<Object>} Resolves with the fileNode