Skip to content

createMemoryProviderFactory

function createMemoryProviderFactory(options?: MemoryProviderOptions): ProviderFactory;

Defined in: src/providers/memory/MemoryProvider.ts:104

Creates a provider factory backed by deterministic in-memory fixture entries.

Useful for tests and examples where you want a real TransferSession without touching disk or the network. Entries are pre-seeded; mutations made through the session are visible to subsequent operations on the same provider.

ParameterTypeDescription
optionsMemoryProviderOptionsOptional fixture entries to expose through the memory provider.

ProviderFactory

Provider factory suitable for createTransferClient({ providers: [...] }).

import { createMemoryProviderFactory, createTransferClient } from "@zero-transfer/sdk";
const client = createTransferClient({
providers: [createMemoryProviderFactory({
entries: [
{ path: "/fixtures/hello.txt", content: "hello world" },
{ path: "/fixtures/data.bin", content: new Uint8Array([1, 2, 3]) },
],
})],
});
const session = await client.connect({ host: "fixtures", provider: "memory" });
console.log(await session.fs.list("/fixtures"));