Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports fetch for files in github repository with file:// protocol #133

Closed
ayame113 opened this issue Nov 15, 2021 · 3 comments
Closed

Comments

@ayame113
Copy link

ayame113 commented Nov 15, 2021

It would be nice to be able to fetch github repositories using the file:// protocol, like deno 1.16.
Currently "PermissionDenied: Read access not allowed" error occurs. The code I tried is here.

According to the issue comments, fetching local files seems to have worked in the past. Was this intentionally removed? Or is my code wrong?

@ayame113 ayame113 changed the title Supports fetch for files in github repository Supports fetch for files in github repository with file:// protocol Nov 15, 2021
@lucacasonato
Copy link
Member

It is supported in Deno 1.16, it just has not been shipped to Deno Deploy yet. We will be addressing this is in the next few days.

@ayame113
Copy link
Author

I got it. thank you!

@satyarohith
Copy link
Member

@ayame113, fetch() now supports file:// URLs in deploy. With a project linked to GitHub, the following source in main.ts should work:

import { serve } from "https://deno.land/std@0.114.0/http/server.ts";

function handler(req: Request): Promise<Response> {
  // Note: import.meta.url is a file:// URL.
  return fetch(new URL("./main.ts", import.meta.url));
}

console.log("Listening on http://localhost:8000");
await serve(handler);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants