compress() — svelte Function Reference
Architecture documentation for the compress() function in hash.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 2a2ac188_28fd_31d5_5672_6c04b38aec43["compress()"] 701d9da6_675f_b6d1_ad30_b067ef212b63["hash.js"] 2a2ac188_28fd_31d5_5672_6c04b38aec43 -->|defined in| 701d9da6_675f_b6d1_ad30_b067ef212b63 style 2a2ac188_28fd_31d5_5672_6c04b38aec43 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
playgrounds/sandbox/scripts/hash.js lines 50–70
async function compress(payload) {
const reader = new Blob([payload])
.stream()
.pipeThrough(new CompressionStream('gzip'))
.getReader();
let buffer = '';
for (;;) {
const { done, value } = await reader.read();
if (done) {
reader.releaseLock();
return btoa(buffer).replaceAll('+', '-').replaceAll('/', '_');
} else {
for (let i = 0; i < value.length; i++) {
// decoding as utf-8 will make btoa reject the string
buffer += String.fromCharCode(value[i]);
}
}
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does compress() do?
compress() is a function in the svelte codebase, defined in playgrounds/sandbox/scripts/hash.js.
Where is compress() defined?
compress() is defined in playgrounds/sandbox/scripts/hash.js at line 50.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free