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
...descriptors: Deno.PermissionDescriptor[]Return Type
Promise<void | Deno.PermissionDescriptor[]>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
descriptors: Deno.PermissionDescriptor[]Return Type
Promise<void | Deno.PermissionDescriptor[]>