You can build a useful browser RAW previewer without uploading the camera file: open the selected File locally, request its embedded preview first, and move full decoding into a Web Worker. The prerequisite is a browser build that can serve WebAssembly assets; if you want one decode to use multiple WASM threads, your deployed page must also be cross-origin isolated. FlashRaw is a practical option because its JavaScript package accepts browser files, exposes previews and display-ready RGBA output, and includes a worker pool.

This is a preview workflow, not a promise that every .RAW extension will decode or render identically to another application. Verify the exact camera and compression mode in the project’s format matrix before you make a support promise.

Camera files moving through a format compatibility check with a review branch

1. Decide what the first screen needs to show

Start with a small contract: the first screen needs a camera name, dimensions, and a fast visual acknowledgement that the correct file was chosen. It does not necessarily need a full demosaic. That distinction keeps a large file from blocking the interface when an embedded JPEG is enough.

For each fixture, write down the camera, file variant, expected outcome, and whether a preview is acceptable. This follows the same discipline as a six-file RAW decoder fixture pack: use files you may lawfully retain and include a failure case.

Expected result: you have a short acceptance list before choosing an API or measuring speed.

2. Add the browser package and open the selected file locally

Install the package in a Vite, webpack, Rollup, or similar browser build:

npm install flashraw

Then pass the browser File directly to the decoder. The package documentation shows that FlashRaw.open() accepts a File or Blob; this keeps the selected bytes in the browser rather than requiring an upload endpoint.

import { FlashRaw } from 'flashraw';

export async function inspectRaw(file) {
  const raw = await FlashRaw.open(file);
  try {
    return {
      camera: raw.metadata.camera,
      width: raw.metadata.width,
      height: raw.metadata.height,
      preview: await raw.preview()
    };
  } finally {
    raw.close();
  }
}

If preview is present and JPEG-backed, turn its bytes into a Blob URL and show it immediately. If it is absent, show a clear “full preview required” state instead of treating the file as broken. The FlashRaw browser demo is also useful for observing a local-only flow before you ship one.

Expected result: selecting a file produces metadata and either an embedded preview or an explicit fallback state.

3. Put full decoding in a worker

A full RAW-to-RGBA conversion can take longer and use more memory than reading metadata. Keep it off the interface thread with FlashRaw’s documented worker pool:

import { createWorkerPool } from 'flashraw/worker';

const pool = createWorkerPool({ size: 2 });

export async function renderRaw(file, signal) {
  return pool.decode(file, {
    output: 'rgba8',
    demosaic: 'half-size',
    signal
  });
}

export function stopPreview() {
  pool.terminate();
}

Use half-size only when a faster inspection view is acceptable; offer a deliberate full-resolution action instead of silently downgrading an export-quality view. For a longer-lived editor, keep the file open in one worker and close its remote handle when the user switches files.

Local browser file processing separated into a worker and returned as a preview

Expected result: scrolling and canceling remain responsive while the worker prepares an rgba8 frame.

4. Treat threads as a deployment check, not a default assumption

A worker pool helps responsiveness on ordinary pages. FlashRaw’s multithreaded WASM build is a separate optimization: in browsers it needs cross-origin isolation and shared memory. Before enabling it, serve these headers and check the live deployment—not only local development:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

Those headers can affect third-party scripts, fonts, analytics, and images. Use getCapabilities() from the package to report the active thread mode, then keep the single-threaded path functional when isolation is unavailable. That is a better release gate than assuming every CDN configuration qualifies.

Expected result: your UI tells support and QA whether the page used threads, without blocking previews on sites that cannot adopt the headers yet.

5. Test formats, output intent, and failure paths

RAW support is a matrix of camera, codec, bit depth, and mode—not a binary extension check. FlashRaw’s official matrix marks variants as verified, partial, experimental, or unsupported, and its documentation lists a small set of corpus formats that are deliberately rejected. Test the exact files your customers submit.

For every fixture, capture these outcomes:

Check Passing outcome What to do when it fails
Metadata camera and dimensions are plausible preserve the structured error and stop processing
Embedded preview preview displays with expected orientation offer full decode or a no-preview message
Display RGB rgba8 frame draws with the expected size inspect demosaic, white balance, and colour choices
Cancellation abandoned decode stops without freezing the page verify the worker remains or is recreated cleanly
Exact camera variant matrix status is suitable for your product route to review; do not claim compatibility yet

This check protects a product decision that simple performance work misses. For context on separating output requirements from timing, see how to choose RAW decoder output before optimizing decode speed and the practical supplier-ingest checklist for checking RAW photos before a Shopify upload.

A small camera-file fixture set being inspected before preview rendering

If you compare libraries, reproduce the test on your own files. FlashRaw publishes benchmark methods and counterexamples, including cases where another decoder is faster; that is more useful than turning a median into a universal claim.

6. Make the privacy boundary visible

“Local” should be an observable product rule: do not add a hidden upload fallback, state when generated previews remain in memory, revoke Blob URLs when replaced, and document any telemetry that records file metadata. A WebAssembly decoder reduces the need for an upload service, but your application still needs ordinary limits for file size, cancellation, error handling, and memory.

Start with one real camera file from each workflow you support, implement the worker path, and keep unsupported variants in a visible review branch. From there, explore FlashRaw’s browser demo and documentation to decide whether metadata-only inspection, embedded previews, or full RGB development belongs in each screen.