Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ecopages/file-system

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ecopages/file-system

Runtime-agnostic file system utilities for Ecopages with Bun and Node adapters

latest
Source
npmnpm
Version
0.2.0-alpha.0
Version published
Maintainers
1
Created
Source

@ecopages/file-system

Runtime-agnostic file system utilities for Ecopages with optimized Bun and Node.js adapters.

Features

  • Runtime Detection: Automatically selects optimal adapter based on runtime
  • Bun Optimized: Uses Bun.Glob, Bun.hash, Bun.file for maximum performance
  • Node.js Fallback: Uses fast-glob and crypto for full compatibility
  • Type Safe: Full TypeScript support with consistent interface

Installation

bun add @ecopages/file-system

Usage

import { fileSystem } from '@ecopages/file-system';

// Glob files
const files = await fileSystem.glob(['**/*.ts'], { cwd: './src' });

// Read files
const content = await fileSystem.readFile('file.txt');

// Hash files
const hash = fileSystem.hash('file.txt');

// Write files
fileSystem.write('output.txt', 'Hello World');

// Check existence
if (fileSystem.exists('file.txt')) {
	// ...
}

API

MethodDescription
glob(patterns, options)Find files matching glob patterns
readFile(path)Read file as string (async)
readFileSync(path)Read file as string (sync)
readFileAsBuffer(path)Read file as Buffer
write(path, content)Write content to file
writeAsync(path, content)Write content to file (async)
exists(path)Check if path exists
ensureDir(path)Ensure directory exists
copyDir(src, dest)Copy directory recursively
copyFile(src, dest)Copy single file
remove(path)Remove file or directory
removeAsync(path)Remove file or directory (async)
hash(path)Get hash of file contents
gzipFile(path)Gzip a single file
gzipDir(path, extensions)Gzip files in directory
isDirectory(path)Check if path is directory
verifyFileExists(path)Throw if file doesn't exist

Performance

Benchmark results (Apple M4):

OperationBunFileSystemNodeFileSystem
glob (100 files)64.85 µs71.06 µs
hash (1MB file)87 µs393 µs

Bun adapter is 4.5x faster for file hashing.

License

MIT

Keywords

ecopages

FAQs

Package last updated on 08 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts