Part of the alepha package. Import from alepha/file.
npm install alepha
Provides file system capabilities for Alepha applications with support for multiple file sources and operations.
The file module enables working with files from various sources (URLs, buffers, streams) and provides utilities for file type detection, content type determination, and common file system operations.
Providers are classes that encapsulate specific functionality and can be injected into your application. They handle initialization, configuration, and lifecycle management.
For more details, see the Providers documentation.
Node.js implementation of FileSystem interface.
1const fs = alepha.inject(NodeFileSystemProvider); 2 3// Create from URL 4const file1 = fs.createFile({ url: "file:///path/to/file.png" }); 5 6// Create from Buffer 7const file2 = fs.createFile({ buffer: Buffer.from("hello"), name: "hello.txt" }); 8 9// Create from text10const file3 = fs.createFile({ text: "Hello, world!", name: "greeting.txt" });11 12// File operations13await fs.mkdir("/tmp/mydir", { recursive: true });14await fs.cp("/src/file.txt", "/dest/file.txt");15await fs.mv("/old/path.txt", "/new/path.txt");16const files = await fs.ls("/tmp");17await fs.rm("/tmp/file.txt");