/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v26.5.1
lib/vfs.js
37 строк
1 KB
Matteo Collina
vfs: add minimal node:vfs subsystem
20 июн 2026, 18:50
Не верифицирован
20 июн 2026, 18:50
7bc93a6
Код
Авторство
О чём код?
'use strict'; const { FunctionPrototypeSymbolHasInstance, } = primordials; const { VirtualFileSystem } = require('internal/vfs/file_system'); const { VirtualProvider } = require('internal/vfs/provider'); const { MemoryProvider } = require('internal/vfs/providers/memory'); const { RealFSProvider } = require('internal/vfs/providers/real'); /** * Creates a new VirtualFileSystem instance. * @param {VirtualProvider} [provider] The provider to use (defaults to MemoryProvider) * @param {object} [options] Configuration options * @param {boolean} [options.moduleHooks] Whether to enable require/import hooks (default: true) * @param {boolean} [options.virtualCwd] Whether to enable virtual working directory * @returns {VirtualFileSystem} */ function create(provider, options) { // Handle case where first arg is options (no provider) if (provider != null && !FunctionPrototypeSymbolHasInstance(VirtualProvider, provider) && typeof provider === 'object') { options = provider; provider = undefined; } return new VirtualFileSystem(provider, options); } module.exports = { create, VirtualFileSystem, VirtualProvider, MemoryProvider, RealFSProvider, };