Giter Club home page Giter Club logo

workers-rs's Introduction

workers-rs

This is a fork that is up to rebased up to cloudflare/workers-rs.

The problem of the original repository is that it does not provide the Rust version of getAssetFromKV function which exists in the JavaScript package, but this feature is required by our own leptos-cloudflare integration that uses KV to host static assets. For deployment, wrangler will derive hashes from worker site files and append it to the file name before the extension. For example, client_bg.wasm will become client_bg.849eaf9261.wasm. However, under local development, the file name does not contain a hash. These discrepancies need to be handled. workers-rs does not offer such a functionality natively. There's a related PR at cloudflare#308 but it seems that Cloudflare team is not keen on merging the PR or even integrating this feature into workers-rs repository.

Therefore, this fork adds one more function to ctx.env from ctx: worker::Context which is a parameter to the worker handler function: asset_key(&self, name: &str) -> worker::Result<String>. This is used to retrieve the name of an asset uploaded to KV when the worker is deployed, or the local name of the asset if the worker is run locally. Note that this only works if site was configured in wrangler.toml.

The usage example can be found in the doc comments of asset_key.

workers-rs's People

Contributors

zebp avatar bytealex avatar nilslice avatar kflansburg avatar jdon avatar flareline avatar fkettelhoit avatar slester avatar bastidood avatar leoorshansky avatar jakubadamw avatar jyn514 avatar voidstar0 avatar xtuc avatar sebastiaanyn avatar witchof0x20 avatar fisherdarling avatar dbw9580 avatar aseure avatar 9oelm avatar cmoore-darwinium avatar ocsfrank avatar mendess avatar gnp avatar dav1dde avatar cjpatton avatar cathalmullan avatar irvinebroque avatar kiwiyou avatar jlcanela avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.