Client for the qBraid Quantum storage service.
npm install @qbraid-core/storage
import { FileStorageClient } from '@qbraid-core/storage';
const client = new FileStorageClient();
const filePath = 'path/to/file.txt'; // existing file on the local filesystem
const namespace = 'my-namespace';
const objectPath = 'server/path/to/file.txt';
const response = await client.uploadFile(filePath, namespace, objectPath);
console.log(response);
import { FileStorageClient } from '@qbraid-core/storage';
const client = new FileStorageClient();
const namespace = 'my-namespace';
const objectPath = 'server/path/to/file.txt';
const downloadResponse = await client.downloadFile(namespace, objectPath);
if (downloadResponse.stream) {
const stream = downloadResponse.stream as Readable;
let fileContents = '';
stream.on('data', chunk => {
fileContents += chunk;
});
stream.on('end', () => {
console.log('File contents:', fileContents);
});
stream.on('error', err => {
console.error('Error reading file stream:', err);
});
} else if (downloadResponse.error) {
console.error('Error downloading file:', downloadResponse.error);
}
This software is proprietary and subject to the terms of the qBraid Commercial Software License.