Skip to main content

latest
Works with
It is unknown whether this package works with Node.js, Deno, Browsers, Cloudflare Workers, Bun
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Browsers
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 grant
grant(...descriptors: Deno.PermissionDescriptor[]): Promise<void | Deno.PermissionDescriptor[]>
Deprecated

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

Attempts to grant a set of permissions, resolving with the descriptors of the permissions that are granted.

     import { grant } from "@std/permissions";
     const perms = await grant({ name: "net" }, { name: "read" });
     if (perms && perms.length === 2) {
       // do something cool that connects to the net and reads files
     } else {
       // notify user of missing permissions
     }

If one of the permissions requires a prompt, the function will attempt to prompt for it. The function resolves with all of the granted permissions.

Parameters

Return Type

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

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

Attempts to grant a set of permissions, resolving with the descriptors of the permissions that are granted.

     import { grant } from "@std/permissions";
     const perms = await grant([{ name: "net" }, { name: "read" }]);
     if (perms && perms.length === 2) {
       // do something cool that connects to the net and reads files
     } else {
       // notify user of missing permissions
     }

If one of the permissions requires a prompt, the function will attempt to prompt for it. The function resolves with all of the granted permissions.

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 { grant } from "@std/permissions";
or

Import directly with a jsr specifier

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