Filesystem Module
Search & Pattern Matching
High-performance discovery engine leveraging native Go routines. This module provides regex-compliant full-text search and glob-based file discovery that bypasses standard Node.js latency.
Full-Text Search
Query the contents of entire directory trees using highly optimized regex patterns.
.searchInFiles(dir, pattern)
Returns an array of SearchMatch objects including filename, line number, and content snippet.
typescript
const results = __sys__.fs.searchInFiles("./src", "TODO");
results.forEach(m => console.log(`${m.file}:${m.line} -> ${m.content}`));File Discovery
Glob Matching
.findByPattern(dir, glob)
Recursive discovery using standard glob patterns.
typescript
const ts = __sys__.fs.findByPattern("./src", "*.ts"); Ext Filtering
.findByExt(dir, extension)
Fast discovery of specific file extensions.
typescript
const pngs = __sys__.fs.findByExt("./assets", "png");Advanced Pattern Ops
.batchRename(path, pattern, replacement, dryRun?)
Mass rename files matching a regex. Use dryRun: true to preview changes.
typescript
// Preview rename of .js to .mjs
const preview = __sys__.fs.batchRename("./dist", "\\.js$", ".mjs", true);.findModifiedSince(dir, hours)
Finds files changed within the specified temporal window.
typescript
const recent = __sys__.fs.findModifiedSince("./src", 24); // Last 24 hoursArchive & Compression
Learn how to handle TAR and GZIP archives with zero-copy performance.
