What hashing algorithm is used for the "etag" value for worker scripts?

I tried using the etag npm package, but it produces different values than the Cloudflare API returns. I also tried md5. Is this documented somewhere?

I am not sure, @aleclarson1, maybe @signalnerve knows?

Hi @aleclarson1,

Sorry, but the etag returned by the API is not something you can compute yourself. Moreover, we might change how it is produced in the future.

Out of curiosity, why are you trying to reproduce it?


I want to compute the etag to avoid uploading an identical copy of a worker when my build runs in CI.

I see. Unfortunately, there’s no way to do this. You’ll have to track this in some other way. For example, perhaps you could store the current script hash in Workers KV.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.