Skip to content

Instantly share code, notes, and snippets.

@fd
Last active March 4, 2019 10:28
Show Gist options
  • Save fd/fb618ff2b0a9526be55c35b139965863 to your computer and use it in GitHub Desktop.
Save fd/fb618ff2b0a9526be55c35b139965863 to your computer and use it in GitHub Desktop.
const { permissions, revokePermission, open } = Deno;
const encoder = new TextEncoder();
const logPromise = open('request.log', 'a+');
// Revoke all permissions
const perms = permissions();
for (const perm in perms) {
if (perms[perm]) {
console.log('revoked '+perm);
revokePermission(perm as any);
}
}
console.log(permissions());
(async () => {
const logfile = await logPromise;
await logfile.write(encoder.encode("hello\n"));
await open('some other file', 'a+');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment