// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// Copyright the Browserify authors. MIT License.

export type PathType = "file" | "dir" | "symlink";

/**
 * Get a human readable file type string.
 *
 * @param fileInfo A FileInfo describes a file and is returned by `stat`,
 *                 `lstat`
 */
export function getFileInfoType(fileInfo: Deno.FileInfo): PathType | undefined {
  return fileInfo.isFile
    ? "file"
    : fileInfo.isDirectory
    ? "dir"
    : fileInfo.isSymlink
    ? "symlink"
    : undefined;
}

// denoCacheMetadata={"headers":{"etag":"\"e0b3e5a549ac431f296cda32b25aff5c\"","x-content-type-options":"nosniff","age":"1014341","cf-cache-status":"HIT","access-control-expose-headers":"*","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","set-cookie":"__cf_bm=zoYg6Sy5ehhI42xnFZpyZkZag.dIFq5QDyo89Cjbk3Q-1785241875.2096448-1.0.1.1-Spui7DACJiH4CZbGzuuq7FEKubYGgYwbxALEtq7Ybarb_Ug2qSFYbAKQVc3KO_fT.6Ip4dtFAEbcSU9vzvOrt6Mjw3bjtxvJ1yYXx34J6lUeiCzapCQJwsMg5jxYiCkK; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","content-length":"550","alt-svc":"h3=\":443\"; ma=86400","cf-ray":"a223e657fb3f7db6-LAX","accept-ranges":"bytes","cache-control":"public, max-age=31536000, immutable","x-robots-tag":"noindex","vary":"Origin","access-control-allow-origin":"*","cross-origin-resource-policy":"cross-origin","x-jsr-backend":"modules","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","server":"cloudflare","date":"Tue, 28 Jul 2026 12:31:15 GMT","content-type":"text/typescript","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=lJF3EmCZGt%2FnMe%2FyZEFxuSppnOpx%2F3jl%2FsHFB4HcpLT1zIxi9FEzmILD1JDWE4BjR2Zxtx6DYGB9JfXuqErXn%2Fs8%2BMUmRYWgdo%2BXRxaBBJIPcs3VyZhJ4ok%3D\"}]}"},"url":"https://jsr.io/@std/fs/0.224.0/_get_file_info_type.ts","time":1785241875}