🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@ecopages/file-system

Package Overview
Dependencies
Maintainers
1
Versions
88
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

Source
npmnpm
Version
0.2.0-beta.23
Version published
Weekly downloads
1.8K
102.5%
Maintainers
1
Weekly downloads
 
Created
Source

@ecopages/file-system

Runtime-agnostic file system utilities for Ecopages that automatically select the optimal adapter (Bun or Node.js) based on the execution environment.

Features

  • Runtime Detection: Automatically uses Bun.Glob, Bun.hash, Bun.file for maximum performance on Bun, and falls back to native node:fs/promises.glob() and crypto on Node.js.
  • Unified Interface: Write file system code once; let the runtime handle the optimization.
  • Type Safe: Full TypeScript support with a consistent API.

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

Keywords

ecopages

FAQs

Package last updated on 14 Jul 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