summaryrefslogtreecommitdiff
path: root/cli/tests/workers/read_check_granular_worker.js
blob: d1a205391e193443ba6cd0971cb808aef585e857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { fromFileUrl } from "../../../test_util/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,
  });
};