Ephemeral In-Memory Rasterization: Why Zero Files Touch Our Disks
Designing a browser-to-print pipeline that relies exclusively on transient memory buffers, garbage-collected Blobs, and zero database disk writes.
The Cloud Persistence Anti-Pattern
Most digital printing platforms function as follows: ``` Browser ──> Amazon S3 / Google Cloud Storage ──> Disk DB Record ──> Backend Worker ──> External Vendor ```
Even if the provider promises to "delete files after 24 hours," those files exist on non-volatile flash storage during that period. Deleted files in distributed block stores often persist in snapshots, WAL replication logs, cold backups, and cache tiers for weeks or months.
For a service built on true privacy, **preventing storage from happening in the first place** is orders of magnitude safer than attempting to clean up stored files after the fact.
Client-Side Preparation via Canvas & ArrayBuffers
In SHHHH, when a user enters their private 15-minute session, photos selected from their phone or laptop are **never uploaded to a central cloud server** upon file selection.
Instead, the files are read locally into the client's web browser using the HTML5 `FileReader` API and represented as memory-backed `Blob` objects:
// Client-side local inspection without server transmission
function handleFileSelection(files) {
const localPhotos = files.map((file) => {
const objectUrl = URL.createObjectURL(file);
return {
id: crypto.randomUUID(),
file,
url: objectUrl,
rotation: 0,
finish: 'GLOSS', // Per-photo toggle
caption: '',
};
});
setPhotos(localPhotos);
}Transforming and Rotating Locally
If the user needs to rotate an image 90 degrees or adjust crop bounds to fit the 5×6 or Polaroid chin format, that transformation executes entirely within an off-screen HTML5 `<canvas>` inside their device's GPU/CPU:
function renderCorrectedBitmap(imageElement, rotation) {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
if (rotation === 90 || rotation === 270) {
canvas.width = imageElement.naturalHeight;
canvas.height = imageElement.naturalWidth;
} else {
canvas.width = imageElement.naturalWidth;
canvas.height = imageElement.naturalHeight;
}
ctx.translate(canvas.width / 2, canvas.height / 2);
ctx.rotate((rotation * Math.PI) / 180);
ctx.drawImage(imageElement, -imageElement.naturalWidth / 2, -imageElement.naturalHeight / 2);
return new Promise((resolve) => {
canvas.toBlob((blob) => resolve(blob), 'image/jpeg', 0.98);
});
}Memory Disposal via Garbage Collection
The moment the customer hits **PRINT NOW**: 1. The canvas stream is converted into a binary chunk and passed through the single-use hardware upload link directly into the printer buffer. 2. The browser immediately executes `URL.revokeObjectURL(p.url)`, unbinding the memory address. 3. The array references are nullified, permitting the JavaScript V8 engine to reclaim the heap allocation instantly. 4. When the 15-minute session countdown expires, the session state is purged and the session token is invalidated.
SHHHH maintains dedicated private printers across major metro cities in India. These machines are never utilized for commercial bulk runs, marketing collateral, or public print orders. Delivered nationwide across India in 5 to 6 working days in opaque, tamper-evident packaging.