@devicepark/storage-client
v1.0.0
Published
Node.js client for DevicePark Storage API
Readme
@devicepark/storage-client
Node.js client for interacting with the DevicePark Storage API.
This library enables uploading, downloading, retrieving metadata, and deleting application files in the DevicePark platform.
✨ Features
- ✅ OAuth2 Client Credentials support (via shared config)
- ♻️ Token caching, retry and error handling (powered by Axios interceptors)
- 📦 File operations: stream upload, download, metadata retrieval, deletion and more
📦 Installation
npm install @devicepark/storage-client🚀 Usage
import { DeviceStorageClient } from '@devicepark/storage-client';
import { init } from '@devicepark/shared';
import fs from 'fs';
init({
apiUrl: 'https://<devicepark_api_uri>',
authentication: {
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
issuerUri: 'https://<devicepark_auth_uri>',
}
});
// Upload a file
const stream = fs.createReadStream('./build/my-app.ipa');
const uploadResponse = await DeviceStorageClient.uploadFile('my-app.ipa', stream);
console.log(uploadResponse.fileKey);
// Download file stream
const fileStream = await DeviceStorageClient.downloadFile(uploadResponse.fileKey);
// Pipe to file system or another stream consumer
// Get metadata
const metadata = await DeviceStorageClient.getFileMetadata(uploadResponse.fileKey);
console.log(metadata);
// Delete file
await DeviceStorageClient.deleteFile(uploadResponse.fileKey);🔗 Related Packages
🛡 License
MIT
