Skip to main content

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
function grantOrThrow
grantOrThrow(...descriptors: Deno.PermissionDescriptor[]): Promise<void>
Deprecated

(will be removed in 1.0.0) Use the Deno Permissions API directly instead.

Attempts to grant a set of permissions or rejects.

     import { grantOrThrow } from "@std/permissions";
     await grantOrThrow({ name: "env" }, { name: "net" });

If the permission can be prompted for, the function will attempt to prompt. If any of the permissions are denied, the function will reject for the first permission that is denied. If all permissions are granted, the function will resolve.

Parameters

Return Type

grantOrThrow(descriptors: Deno.PermissionDescriptor[]): Promise<void>
Deprecated

(will be removed in 1.0.0) Use the Deno Permissions API directly instead.

Attempts to grant a set of permissions or rejects.

     import { grantOrThrow } from "@std/permissions";
     await grantOrThrow([{ name: "env" }, { name: "net" }]);

If the permission can be prompted for, the function will attempt to prompt. If any of the permissions are denied, the function will reject mentioning the the denied permissions. If all permissions are granted, the function will resolve.

Parameters

Return Type

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/permissions

Import symbol

import { grantOrThrow } from "@std/permissions";
or

Import directly with a jsr specifier

import { grantOrThrow } from "jsr:@std/permissions";