Context-aware file transfer skill for OpenClaw ecosystem. Intelligently transfers files based on conversation context with progress tracking.
bash
npm install file-transfer
javascript
import { FileTransferSkill } from 'file-transfer';
const skill = new FileTransferSkill({
channels: { telegram: { enabled: true } }
});
const result = await skill.sendFileWithContext({
file: '/path/to/document.pdf',
caption: 'Team weekly report',
context: { chatId: '-1003655501651' }
});
javascript
import { TelegramAdapter } from 'file-transfer/src/adapters/telegram-adapter.js';
const adapter = new TelegramAdapter();
const result = await adapter.sendFile({
filePath: '/path/to/file.pdf',
chatId: '-1003655501651',
caption: 'Document sharing'
});
Transfers a file with intelligent context detection.
Parameters:
file (string, required): Path to the filecaption (string, optional): File descriptioncontext (object, optional): Conversation context with chatIdReturns:
success (boolean): Transfer success statusmessageId (string): Message IDcontext (object): Context analysis result (scenario, urgency, confidence)stats (object): Transfer statistics (size, duration, channel)Retrieves file transfer history.
Parameters:
options (object, optional): Query optionsReturns:
history (array): Transfer history recordsstats (object): Transfer statisticsjavascript
const skill = new FileTransferSkill({
contextEngine: {
enableAI: false,
maxHistoryLength: 10
},
file: {
maxFileSize: 100 * 1024 * 1024, // 100MB
allowedMimeTypes: ['application/pdf', 'image/jpeg', ...]
},
channels: {
telegram: {
enabled: true,
maxFileSize: 50 * 1024 * 1024 // 50MB
}
}
});
The ContextEngine analyzes file transfers and returns:
FieldValuesDescriptionscenarioshare, backup, collaborate, archiveTransfer intenturgencylow, medium, high, criticalPriority levelconfidence0.0 - 1.0Analysis confidencefileCategorydocument, image, video, archive, codeFile classification
bash
npm test # All tests
npm run test:unit # Unit tests
npm run test:integration # Integration tests
MIT License - see LICENSE for details.