Skip to main content
function decode
import { decode } from "https://deno.land/x/etag@0.0.1/mod.ts";

Decode an etag into the relevant file info.

Examples

Example 1

// continuing the example from etag.encode

import * as etag from "https://deno.land/x/etag@0.0.1/mod.ts";
import $ from "https://deno.land/x/dax/mod.ts";

for await (const f of $.fs.expandGlob("./src/*.ts")) {
  console.log(f.name);
  const stat = Deno.statSync(f.path);

  const encoded = etag.encode(stat);
  console.log("  stat:\n\t%s", JSON.stringify(stat, null, 2));
  console.log("  eTag:\n\t%s", encoded);

  const decoded = etag.decode(encoded);
  console.log("  decoded:\n\t%s\n", JSON.stringify(decoded, null, 2));
}

Parameters

etag: string

The ETag to decode

Returns

Partial<DecodedStatTag> | Partial<DecodedEntityTag>