Skip to content
demuddler

Install

Install @demuddler/importer, add your licence key and define a schema. Use the example to receive rows in your application.

This example opens a file and counts the finished rows in the browser. It does not need a backend. When it works, connect your application with Deliver rows.

  1. Sign in.
  2. On Account, enter the hostname of your application, such as app.acme.com. You can leave out https://. Add more hostnames under Domains, one at a time. For local development, also add localhost. Your plan covers a number of sites.
  3. Accept the licence agreement and select Create the licence. A paid plan from Pricing shows Finish the setup instead.
  4. Copy the install code. It holds the public licence key.

Serve the page over HTTPS. For local development, you can use HTTP on localhost. Do not open the page from a file:// URL. Licensing explains hostname matching and the licence key.

Terminal window
npm install @demuddler/importer
Coming soon

The examples use a bundler such as Vite. A plain script tag cannot import a bare package name without a bundler or an import map.

The package contains the frame loader, the React adapter and the TypeScript types. The interface and the engine load from the hosted runtime. You do not copy a stylesheet, a worker or a WebAssembly file into your application.

Add this markup to the page that loads src/main.ts:

<demuddler-importer style="height: 640px"></demuddler-importer>
<p id="import-status" role="status">Choose a file to start.</p>
<script type="module" src="/src/main.ts"></script>

Create src/main.ts. Replace YOUR_LICENCE_KEY with your licence key.

import "@demuddler/importer";
import type { ImportResult, ImporterSchema } from "@demuddler/importer";
const schema: ImporterSchema = {
fields: [
{
key: "email",
label: "Email address",
dtype: "text",
rules: [{ type: "required" }, { type: "format", format: "email" }],
},
{ key: "name", label: "Full name", dtype: "text" },
],
};
const importer = document.querySelector("demuddler-importer");
const status = document.querySelector("#import-status");
if (!importer || !status) throw new Error("The import page is missing its controls.");
const showStatus = (message: string) => {
status.textContent = message;
};
async function receive(result: ImportResult): Promise<void> {
let rows = 0;
for await (const batch of result.batches({ size: 500 })) {
rows += batch.rows.length;
}
showStatus(`Received ${rows} rows in this browser. Nothing was uploaded.`);
}
importer.schema = schema;
importer.licenceKey = "YOUR_LICENCE_KEY";
importer.handoff = true;
importer.addEventListener("complete", ({ detail }) => {
detail.waitUntil(receive(detail.result));
});
importer.addEventListener("error", ({ detail }) => showStatus(detail.message));

Save this text as customers.csv, and choose the file in the importer:

email,name
alex@example.test,Alex Smith
sam@example.test,Sam Jones

Make sure that the columns match the fields, then finish the import. The status must show two rows.

handoff sends the finished rows to your page. Without it, the importer offers the finished file as a download instead.

The complete event gives a result handle, not the rows. The handler reads the rows from result.batches(). This handler counts the rows and does not save them. Before you release, replace it with the delivery code of your application.

If your page has a Content Security Policy, add https://runtime.demuddler.com to frame-src. Your page needs no other source for Demuddler. The frame loads the importer code from that address. The files and their values stay in the browser and do not go to Demuddler. See Parent Content Security Policy.

Task Page
Use React, Next.js, Vue, Svelte, Angular or Astro Frameworks
Define fields, types and rules Schema
Send the finished rows to your backend Deliver rows
Change colours, text or features Component reference
Correct an empty frame or a refused licence Troubleshooting