summaryrefslogtreecommitdiff
path: root/cli/tests/workers/read_check_granular_worker.js
blob: 4eddb7a758ddab6141d6f5e1bd55e06ad3396d3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { fromFileUrl } from "../../../std/path/mod.ts";

onmessage = async ({ data }) => {
  const { state } = await Deno.permissions.query({
    name: "read",
    path: fromFileUrl(new URL(data.route, import.meta.url)),
  });

  postMessage({
    hasPermission: state === "granted",
    index: data.index,
  });
};