Esente
Esente
Explore posts from servers
DDeno
Created by csjh on 5/1/2024 in #help
Using `Deno.FsFile.prototype.readable` with `Response`
That's the same way I would do. But I think using will become a thing soon, and the FileFS will support that.
9 replies
CDCloudflare Developers
Created by Esente on 4/16/2024 in #workers-help
TCP Socket does not seem to work on Worker
Still does not work.
5 replies
CDCloudflare Developers
Created by Esente on 4/16/2024 in #workers-help
TCP Socket does not seem to work on Worker
Just a small update. I was able to open https://connect.fifo.workers.dev/gopher/wbgopher from clicking the link in this thread, and see the response text. However, when I refresh the link, the same issue happens.
5 replies
CDCloudflare Developers
Created by Esente on 4/16/2024 in #workers-help
TCP Socket does not seem to work on Worker
The same example code on the TCP sockets page:
import { connect } from 'cloudflare:sockets';

export default {
async fetch(req: Request) {
const gopherAddr = { hostname: "gopher.floodgap.com", port: 70 };
const url = new URL(req.url);

try {
const socket = connect(gopherAddr);

const writer = socket.writable.getWriter()
const encoder = new TextEncoder();
const encoded = encoder.encode(url.pathname + "\r\n");
await writer.write(encoded);

return new Response(socket.readable, { headers: { "Content-Type": "text/plain" } });
} catch (error) {
return new Response("Socket connection failed: " + error, { status: 500 });
}
}
};
import { connect } from 'cloudflare:sockets';

export default {
async fetch(req: Request) {
const gopherAddr = { hostname: "gopher.floodgap.com", port: 70 };
const url = new URL(req.url);

try {
const socket = connect(gopherAddr);

const writer = socket.writable.getWriter()
const encoder = new TextEncoder();
const encoded = encoder.encode(url.pathname + "\r\n");
await writer.write(encoded);

return new Response(socket.readable, { headers: { "Content-Type": "text/plain" } });
} catch (error) {
return new Response("Socket connection failed: " + error, { status: 500 });
}
}
};
5 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
Which is kinda a weird thing to say in a Deno's forum 😄
17 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
In this case, there are couple of ways. 1. Go all in with JS by intercepting the submit event on the form, and use fetch to submit instead. Using the response to update the page. 2. Use something like HTMZ to update part of the page after form submission (through iframe technique). Sorry for walking you through these choices. I'm all about doing thing with as little JS as possible and taking advantage of what HTML can already provide.
17 replies
DDeno
Created by anggoran on 4/4/2024 in #help
Passing Data in Fresh
I would suggest adding quiz_id as hidden input so it is submitted with the form. No need for extra JS.
17 replies
DDeno
Created by LFCavalcanti on 3/19/2024 in #help
Is there a way to read big files using something like .seek but with ending position as well?
That's my belief too. But I didn't think that .seek would do better by skipping. TIL 🙂
36 replies
DDeno
Created by LFCavalcanti on 3/19/2024 in #help
Is there a way to read big files using something like .seek but with ending position as well?
Just curious, why can't you use ByteSliceStream(start, end)?
36 replies
DDeno
Created by A person on 3/15/2024 in #help
Caching results from API
Ah, sorry I was wrong. I was basing off my previous encounter with errors not having Worker available, but that was probably on Deploy.
11 replies
DDeno
Created by A person on 3/15/2024 in #help
Caching results from API
You can also use Deno.cron to fetch the API every 24h
11 replies
DDeno
Created by A person on 3/15/2024 in #help
Caching results from API
And you can't use the Cache API on Deno Deploy, yet
11 replies
DDeno
Created by A person on 3/15/2024 in #help
Caching results from API
There is no Deno Web Workers.
11 replies
DDeno
Created by Sheik on 3/12/2024 in #help
What to do if they are attacking a project of mine?
I found that people usually put Cloudflare in front of the project.
22 replies
DDeno
Created by David on 3/3/2024 in #help
`.read()` method in `Deno.Conn` or `Deno.FsFile` in Deno 2.0
Are they staying for good, or should we still try to move to ReadableStream?
5 replies
DDeno
Created by ruaan on 1/31/2024 in #help
Fetch request from own server
19 replies
DDeno
Created by ruaan on 1/31/2024 in #help
Fetch request from own server
Without your objective, it's hard to see.
19 replies
DDeno
Created by ruaan on 1/31/2024 in #help
Fetch request from own server
You can have a "ping" job that runs every minute, and it will ensure there is an isolate running for your project.
19 replies
DDeno
Created by ruaan on 1/31/2024 in #help
Fetch request from own server
Technically, you maybe to use Deno.cron to keep your isolate alive.
19 replies