Cache binary
See original GitHub issueHi,
I’d like to use Cloudflare Workers as a CDN like explained on this tutorial: https://developers.cloudflare.com/workers/tutorials/configure-your-cdn (full code at the end)
it works well without Worktop but I did not find out how to make it work with worktop as I just received the JSON body property instead of the binary:
{
"locked": false
}
I wonder what would be the equivalent of response = new Response(response.body, { ...response, headers })
with worktop. Here is the actual code:
API.add("GET", "/assets/:id", async (req, res) => {
const response = await fetch("https://f001.backblazeb2.com/file/asset/file.jpg");
res.send(200, response.body);
});
Cache.listen(API.run);
Any idea ?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Binary Cache - NixOS Wiki
A binary cache builds Nix packages and caches the result for other machines. Any machine with Nix installed can be a binary cache...
Read more >Binary Caching - vcpkg
Binary caching is a vcpkg feature that saves copies of library binaries in a shared location that can be accessed by vcpkg for...
Read more >Introducing the Spack Rolling Binary Cache hosted on AWS
The Binary Cache lets you install a package based upon an existing installation, rather than having to recompile it from source. As Spack...
Read more >grab/cocoapods-binary-cache - GitHub
CocoaPods binary cache. Test License Gem. A plugin that helps to reduce the build time of Xcode projects which use CocoaPods by prebuilding...
Read more >Cache introduction - Washington
With our four-byte cache we would inspect the two least significant bits of our memory addresses. ▫ Again, you can see that address...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes that method auto-casts the input to standard/common formats. That’s why end() is available and why you can also directly return Responses from handlers
If I use
res.send(200, response.body, {...}
, I then get that response:I dont think you can get the raw bytes without calling blob() first. Also it seems that
send
function (in response) can’t handle binary content:This is why I used
end
function directly