A TypeScript SDK for the Evex Storage API with unlimited free storage.
- Upload files to Evex Storage
- Download files by key
- Support for multiple data formats (Blob, ArrayBuffer, Text)
- Full TypeScript support
- Error handling and validation
- Built with Bun runtime
bun install evex-storage-sdkimport EvexStorage from 'evex-storage-sdk';
const storage = new EvexStorage();
// Or with custom options
const storage = new EvexStorage({
baseUrl: 'https://storage.evex.land' // default
});// Upload from File object (browser)
const fileInput = document.querySelector('input[type="file"]');
const file = fileInput.files[0];
const result = await storage.upload(file, 'my-file.txt');
if (result.error) {
console.error('Upload failed:', result.error);
} else {
console.log('Download key:', result.downloadKey);
}
// Upload from Blob
const blob = new Blob(['Hello, world!'], { type: 'text/plain' });
const result = await storage.upload(blob, 'hello.txt');
// Upload from ArrayBuffer
const buffer = new ArrayBuffer(8);
const result = await storage.upload(buffer, 'data.bin');const downloadKey = 'your-download-key';
// Download as Response object
const response = await storage.download(downloadKey);
const blob = await response.blob();
// Download directly as Blob
const blob = await storage.downloadAsBlob(downloadKey);
// Download as ArrayBuffer
const buffer = await storage.downloadAsArrayBuffer(downloadKey);
// Download as Text
const text = await storage.downloadAsText(downloadKey);new EvexStorage(options?: EvexStorageOptions)baseUrl?: string- Custom base URL for the API (default:https://storage.evex.land)mirrorUrl?: string- Mirror URL (for future use)
Upload a file to Evex Storage.
Parameters:
file: File | Blob | ArrayBuffer | Uint8Array- The file data to uploadfilename: string- The filename to use
Returns:
Promise<UploadResponse>- Upload result with downloadKey or error
Download a file by its download key.
Parameters:
downloadKey: string- The download key from upload response
Returns:
Promise<Response>- Fetch Response object
Download a file as a Blob.
Download a file as an ArrayBuffer.
Download a file as text.
interface UploadResponse {
downloadKey?: string;
error: string | null;
}
interface EvexStorageOptions {
baseUrl?: string;
mirrorUrl?: string;
}The SDK throws errors for various failure scenarios:
try {
const result = await storage.upload(file, 'test.txt');
if (result.error) {
// Handle API error
console.error('API Error:', result.error);
}
} catch (error) {
// Handle network or other errors
console.error('Upload failed:', error.message);
}Install dependencies:
bun installRun tests:
bun test- Main: https://storage.evex.land/
- Mirror: https://storage.ame-x.net/
MIT