aliendrive-sdk
v1.1.0
Published
Official Node.js SDK for the AlienDrive API — S3-like cloud storage
Maintainers
Readme
aliendrive-sdk
Official Node.js SDK for the AlienDrive API. S3-like interface for cloud file storage.
Install
npm install aliendrive-sdkQuick Start
const { AlienDrive } = require('aliendrive-sdk');
const drive = new AlienDrive({
endpoint: 'https://drive.moltenalien.com',
apiKey: 'mcd_your_api_key_here',
});
// Upload
await drive.putObject({
Key: 'photos/vacation.jpg',
Body: Buffer.from('...'),
ContentType: 'image/jpeg',
});
// Download
const file = await drive.getObject({ Key: 'photos/vacation.jpg' });
console.log(file.Body); // Buffer
// List
const list = await drive.listObjects({ Prefix: 'photos/' });
console.log(list.Contents); // [{ Key, Size, ContentType, ... }]
// Delete
await drive.deleteObject({ Key: 'photos/vacation.jpg' });API
new AlienDrive({ endpoint, apiKey })
Create a client instance.
| Param | Type | Description |
|---|---|---|
| endpoint | string | API URL, e.g. https://drive.moltenalien.com |
| apiKey | string | Your API key (starts with mcd_) |
putObject({ Key, Body, ContentType? })
Upload a file. Folders in the path are auto-created.
await drive.putObject({
Key: 'reports/2026/q1.pdf',
Body: fs.readFileSync('q1.pdf'),
ContentType: 'application/pdf',
});getObject({ Key })
Download a file. Returns { Body, ContentType, ContentLength, ETag, LastModified }.
const { Body } = await drive.getObject({ Key: 'reports/2026/q1.pdf' });
fs.writeFileSync('q1.pdf', Body);headObject({ Key })
Get file metadata without downloading.
const meta = await drive.headObject({ Key: 'reports/2026/q1.pdf' });
console.log(meta.ContentLength); // file size in byteslistObjects({ Prefix?, MaxKeys? })
List files and folders. Returns S3-compatible response with Contents and CommonPrefixes.
const list = await drive.listObjects({ Prefix: 'reports/' });
list.Contents.forEach(f => console.log(f.Key, f.Size));
list.CommonPrefixes.forEach(f => console.log(f.Prefix)); // subfoldersdeleteObject({ Key })
Delete a file. Returns 204 even if key doesn't exist (S3 behavior).
uploadFile(localPath, remotePath?)
Convenience: upload a local file with auto-detected MIME type.
await drive.uploadFile('./photo.jpg', 'photos/photo.jpg');downloadFile(remotePath, localPath)
Convenience: download to a local file.
await drive.downloadFile('photos/photo.jpg', './photo.jpg');TypeScript
Full type definitions included. Works with both require() and TypeScript imports.
import { AlienDrive } from 'aliendrive-sdk';Get an API Key
- Sign up at drive.moltenalien.com
- Go to Settings
- Create an API key
- Copy it (shown only once)
API Docs
Full API documentation at drive.moltenalien.com/api-docs
License
MIT
