sanetram
sanetram
CDCloudflare Developers
Created by sanetram on 1/11/2024 in #workers-help
Remove TextEncoder call on write to stream
I'm diving into streaming responses and I see myself writing this:
await writer.write(encoder.encode('<h1>Hello world!</h1>'));
await writer.write(encoder.encode('<h1>Hello world!</h1>'));
Is this the right way of appending strings or is it possible to remove the encoder.encode call of the TextEndoer?
1 replies
CDCloudflare Developers
Created by sanetram on 12/15/2023 in #general-help
Abuse approach for a social-media-like site powered by Workers
I was reading https://www.cloudflare.com/trust-hub/abuse-approach/ and I would like some clarity on the abuse approach for a site I'm currently scouting service providers for. I would like to explore the possibility of a social-media-like site that would be run entirely on Workers, with the relevant internal reporting features built-in (e.g. AI content scanning, manual reporting, and manual verification) with a goal of takedowns being performed within 24 hours or less of a content update. In the event of Cloudflare receiving a report and supposing something has slipped through my system, Cloudflare mentions: "In the much rarer instance that an abuse report relates to content hosted by Cloudflare through Cloudflare Stream, Cloudflare Pages, Cloudflare Workers, Cloudflare Workers KV, or Cloudflare Images, we may remove or block access to content that we identify as violating our supplemental terms for those products." Does this mean for me that CF would: (1) Forward the report to me so I can remove it from my database (2) Block the specific url before it even reaches my worker or (3) Disable the worker effectively removing my site Apologies for the long post, I want to provide as much information as possible to make sure I could get an accurate answer. Thank you for your time
1 replies
CDCloudflare Developers
Created by sanetram on 12/14/2023 in #workers-help
Typescript option ignored
I just created a project with npm create cloudflare@latest , and after Do you want to use TypeScript? yes it still created JS files and no .tsconfig etc.
2 replies
CDCloudflare Developers
Created by sanetram on 12/14/2023 in #workers-help
Are there import caches?
I read somewhere yesterday that workers are initialised during the TLS handshake to basically remove cold starts. I also read that sometimes isolates are re-used for requests and to not rely on mutable state. I'm currently playing about with dependency injection and I'm wondering whether it would be beneficial to lazily load "providers" (dynamically import) and cache it in global mutable state, or whether to just import it all upfront. I'm thinking cost-centric. Thank you!
21 replies