kian
04/27/2023, 9:31 PMspacey
04/27/2023, 10:02 PM_worker.js
to put the consumer or can I do this some other way. Since the local dev enviroment does not allow me to have a _worker.js without an exported fetch
which i don't need.HardAtWork
04/27/2023, 10:07 PMspacey
04/27/2023, 10:08 PMfunctions
folder is ignored with i introduce a _worker.js fileHardAtWork
04/27/2023, 10:12 PMspacey
04/27/2023, 10:17 PMsilentdevnull
04/27/2023, 10:18 PMWorker exceeded CPU time limit.
when I tried it as it was.Larry
04/27/2023, 10:22 PMkian
04/27/2023, 10:23 PMsilentdevnull
04/27/2023, 10:26 PMsilentdevnull
04/27/2023, 11:20 PMsilentdevnull
04/27/2023, 11:20 PMkian
04/27/2023, 11:24 PMsilentdevnull
04/27/2023, 11:36 PMexport async function onRequest(context) {
const options = {
limit: 500,
include: ['customMetadata'],
};
const listed = await context.env.NAME.list(options);
console.log(listed);
let truncated = listed.truncated;
let cursor = truncated ? listed.cursor : undefined;
while (listed.objects.length < options.limit) {
console.log(listed.objects.name);
}
return new Response("Hello");
}
I couldn't find a fast way to count all the files I have in there so I will have to do that tomorrow.kian
04/27/2023, 11:36 PMkian
04/27/2023, 11:36 PMsilentdevnull
04/27/2023, 11:49 PMkian
04/28/2023, 12:02 AMjs
export async function onRequest(context) {
const options = {
limit: 500,
include: ["customMetadata"],
};
const listed = await context.env.NAME.list(options);
let truncated = listed.truncated;
let cursor = truncated ? listed.cursor : undefined;
while (truncated) {
const next = await context.env.NAME.list({
...options,
cursor: cursor,
});
listed.objects.push(...next.objects);
truncated = next.truncated;
cursor = next.cursor;
}
return Response.json(listed);
}
kian
04/28/2023, 12:02 AMsilentdevnull
04/28/2023, 1:30 AMspacey
04/28/2023, 4:18 AMHono
does anyone know how to get cf.city, cf.timezone
, etc. c.req.cf
does not existChaika
04/28/2023, 4:31 AMjs
app.get('/', (c) => c.text(`Hello ${c.req.raw.cf?.city}`))
spacey
04/28/2023, 4:31 AMspacey
04/28/2023, 5:17 AMenv.QUEUE_NAME.send(data)
?spacey
04/28/2023, 5:20 AMspacey
04/28/2023, 5:23 AMLloyd
04/28/2023, 4:10 PMtsx
export const onRequest: PagesFunction = async ({ request, next }) => {
const response = await fetch(request);
// Clone the response so that it's no longer immutable
const newResponse = new Response(response.body, response);
// Add a custom header with a value
newResponse.headers.append(
"x-workers-hello",
"Hello from Cloudflare Workers"
);
await next();
return newResponse;
}
Lloyd
04/28/2023, 4:11 PMLloyd
04/28/2023, 4:12 PM