{"name":"@jsonjoy.com/fs-node-to-fsa","version":"4.56.4","keywords":["fs","filesystem","fsa","file-system-access","node-to-fsa","adapter"],"author":{"url":"https://github.com/streamich","name":"streamich"},"license":"Apache-2.0","_id":"@jsonjoy.com/fs-node-to-fsa@4.56.4","maintainers":[{"name":"json-joy-team","email":"team@jsonjoy.com"},{"name":"streamich","email":"vadimsdaleckis@gmail.com"}],"homepage":"https://github.com/streamich/memfs/tree/master/packages/fs-node-to-fsa","dist":{"shasum":"159348039d422a5ee24cb3590ba1e176f9e8a31d","tarball":"http://registry-npm.ywwl.com/@jsonjoy.com/fs-node-to-fsa/download/@jsonjoy.com/fs-node-to-fsa-4.56.4.tgz","fileCount":30,"integrity":"sha512-Wewg2JlMkFpUt2Z+RrhdxLrbG6o4XAZB9UdGbpcQS+acvwytmhEjUCCodD3kqY5wPSNpnIbD614VeTA/5jPzvg==","signatures":[{"sig":"MEUCICS/JwER613ldZFeboa7Zrl/Sq0NOIp8sK9aciwbY9TQAiEAndFo7sxAdzv5jUxVt/WZ/eZnbzIxLKJFsVg70YI90hQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77262,"size":17440,"noattachment":false,"key":"/@jsonjoy.com/fs-node-to-fsa/-/@jsonjoy.com/fs-node-to-fsa-4.56.4.tgz"},"jest":{"preset":"ts-jest","rootDir":".","testRegex":".*/(__tests__|__jest__|demo)/.*\\.(test|spec)\\.tsx?$","transform":{"^.+\\.tsx?$":"ts-jest"},"testEnvironment":"node","moduleFileExtensions":["ts","js","tsx"],"testPathIgnorePatterns":["node_modules"],"transformIgnorePatterns":[".*/node_modules/.*"]},"main":"lib/index.js","types":"lib/index.d.ts","engines":{"node":">=10.0"},"funding":{"url":"https://github.com/sponsors/streamich","type":"github"},"gitHead":"3843eddf95cae00136a747f0defa119e856aa475","scripts":{"jest":"node -r ts-node/register ./node_modules/.bin/jest","test":"jest --maxWorkers 7","build":"tsc --project tsconfig.build.json --module commonjs --target es2020 --outDir lib","clean":"rimraf lib typedocs coverage gh-pages yarn-error.log","test:ci":"yarn jest --maxWorkers 3 --no-cache","typedoc":"typedoc","coverage":"yarn test --collectCoverage","typecheck":"tsc -p ."},"typings":"lib/index.d.ts","_npmUser":{"name":"streamich","email":"vadimsdaleckis@gmail.com"},"repository":"streamich/memfs","description":"Adapter to convert Node.js fs API to File System Access API","directories":{},"dependencies":{"@jsonjoy.com/fs-fsa":"4.56.4","@jsonjoy.com/fs-node-utils":"4.56.4","@jsonjoy.com/fs-node-builtins":"4.56.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","memfs":"4.56.4","rimraf":"^5.0.0","ts-jest":"^29.4.2","ts-node":"^10.9.2","typescript":"^5.9.2","@types/jest":"^29.0.0","@types/node":"^20.0.0","@jsonjoy.com/fs-node":"4.56.4"},"peerDependencies":{"tslib":"2"},"_npmOperationalInternal":{"tmp":"tmp/fs-node-to-fsa_4.56.4_1768936263684_0.9125969886911276","host":"s3://npm-registry-packages-npm-production"},"readme":"# @jsonjoy.com/fs-node-to-fsa\n\nAdapter to convert [Node.js fs API][node-fs] to [File System Access API][fsa] (FSA).\n\n## Installation\n\n```bash\nnpm install @jsonjoy.com/fs-node-to-fsa\n```\n\n## Usage\n\n```ts\nimport { nodeToFsa } from '@jsonjoy.com/fs-node-to-fsa';\nimport * as fs from 'fs';\n\nconst dir = nodeToFsa(fs, '/path/to/directory', { mode: 'readwrite' });\n\n// Now use the FSA API\nfor await (const [name, handle] of dir.entries()) {\n  console.log(name, handle.kind);\n}\n```\n\n## FileSystemObserver\n\n`NodeFileSystemObserver` implements the [`FileSystemObserver` proposal][observer]\non top of the Node.js `fs.watch` API. It is a best-effort implementation, per\nthe proposal's allowance for local file systems: `rename` events are classified\ninto `\"appeared\"`/`\"disappeared\"` records by stat-ing the path, and no\n`\"moved\"` records are ever produced.\n\n```ts\nimport { nodeToFsa, NodeFileSystemObserver } from '@jsonjoy.com/fs-node-to-fsa';\nimport * as fs from 'fs';\n\nconst dir = nodeToFsa(fs, '/path/to/directory', { mode: 'readwrite' });\nconst observer = new NodeFileSystemObserver(fs, records => console.log(records));\nawait observer.observe(dir, { recursive: true });\n```\n\n## Reference\n\n- [`nodeToFsa(fs, path, ctx)`](src/index.ts) - Converts a Node.js `fs` module to a `FileSystemDirectoryHandle`.\n- [`NodeFileSystemObserver`](src/NodeFileSystemObserver.ts) - A `FileSystemObserver` implementation backed by `fs.watch`.\n\n[node-fs]: https://nodejs.org/api/fs.html\n[fsa]: https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API\n[observer]: https://developer.mozilla.org/en-US/docs/Web/API/FileSystemObserver\n","publish_time":1768936263830,"_cnpm_publish_time":1768936263830,"dist-tags":{"latest":"4.80.1"}}