New:Socket for Asana Is Now Available.Learn more
Get Started

@jsonjoy.com/fs-node-to-fsa

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsonjoy.com/fs-node-to-fsa

Adapter to convert Node.js fs API to File System Access API

latest
Source
npmnpm
Version
4.71.0
Version published
Weekly downloads
8.8M
-18.35%
Maintainers
2
Weekly downloads
 
Created
Source

@jsonjoy.com/fs-node-to-fsa

Adapter to convert Node.js fs API to File System Access API (FSA).

Installation

npm install @jsonjoy.com/fs-node-to-fsa

Usage

import { nodeToFsa } from '@jsonjoy.com/fs-node-to-fsa';
import * as fs from 'fs';

const dir = nodeToFsa(fs, '/path/to/directory', { mode: 'readwrite' });

// Now use the FSA API
for await (const [name, handle] of dir.entries()) {
  console.log(name, handle.kind);
}

FileSystemObserver

NodeFileSystemObserver implements the FileSystemObserver proposal on top of the Node.js fs.watch API. It is a best-effort implementation, per the proposal's allowance for local file systems: rename events are classified into "appeared"/"disappeared" records by stat-ing the path, and no "moved" records are ever produced.

import { nodeToFsa, NodeFileSystemObserver } from '@jsonjoy.com/fs-node-to-fsa';
import * as fs from 'fs';

const dir = nodeToFsa(fs, '/path/to/directory', { mode: 'readwrite' });
const observer = new NodeFileSystemObserver(fs, records => console.log(records));
await observer.observe(dir, { recursive: true });

Reference

  • nodeToFsa(fs, path, ctx) - Converts a Node.js fs module to a FileSystemDirectoryHandle.
  • NodeFileSystemObserver - A FileSystemObserver implementation backed by fs.watch.

Keywords

fs

FAQs

Package last updated on 04 Sep 2026

Related posts