@five-vm/cli
Version:
High-performance CLI for Five VM development with WebAssembly integration
57 lines • 1.71 kB
JavaScript
/**
* File Utilities - Legacy Compatibility Layer
*
* This module provides backward-compatible functions that wrap the
* centralized FiveFileManager for commands that haven't been updated yet.
*
* DEPRECATED: New code should use FiveFileManager directly.
*/
import { FiveFileManager } from './FiveFileManager.js';
/**
* @deprecated Use FiveFileManager.loadFile() instead
*/
export async function loadAnyFiveFile(filePath) {
const manager = FiveFileManager.getInstance();
const file = await manager.loadFile(filePath, { validateFormat: true });
return {
bytecode: file.bytecode,
abi: file.abi,
format: file.format
};
}
/**
* @deprecated Use FiveFileManager.extractBytecode() instead
*/
export async function getBytecodeFromFile(filePath) {
const { bytecode } = await loadAnyFiveFile(filePath);
return bytecode;
}
/**
* @deprecated Use FiveFileManager.extractABI() instead
*/
export async function getABIFromFile(filePath) {
const { abi } = await loadAnyFiveFile(filePath);
return abi || null;
}
/**
* @deprecated Use FiveFileManager.detectFormat() instead
*/
export function detectFileFormat(filePath) {
const manager = FiveFileManager.getInstance();
return manager.detectFormat(filePath);
}
/**
* @deprecated Use FiveFileManager.validateFileContent() instead
*/
export async function validateBytecodeFile(filePath) {
try {
const manager = FiveFileManager.getInstance();
const file = await manager.loadFile(filePath);
const validation = manager.validateFileContent(file);
return validation.valid;
}
catch (error) {
return false;
}
}
//# sourceMappingURL=fileUtils.js.map