Skip to main content

Storage adapter

Storage adapter is a special service that implements your current client storage (S3, SSH, Azure Blob, etc...) and will be used in the background for most operations.

It is not meant to be used directly, but can be used if you need to, and exposes methods for getting, putting or deleting chunks and rd-index files.

Example usage of storage adapter:


const racDeltaClient = await RacDeltaClient.create({
chunkSize: 1024 * 1024,
maxConcurrency: 6,
storage: {
type: 'ssh',
host: 'localhost',
pathPrefix: '/root/upload',
port: 2222,
credentials: {
username: 'root',
password: 'password',
},
},
});

// This will get rd-index.json from /root/upload/rd-index.json
const remoteIndex = await racDeltaClient.storage.getRemoteIndex();

const chunk = await racDeltaClient.storage.getChunk(remoteIndex?.files[0].chunks[0].hash);

For now, only one work directory is supported per client (pathPrefix).

So if you want to use another storage directory, you must create another client.