@file-services/utils
Common file system utility functions.
API
syncToAsyncFs
: convert a sync-only file system implementation into an async one.createDirectoryFs
: A file system wrapper that adds directory scoping to any IFileSystem
implementation.
Usage
Directory scoped file system
Install library in project:
yarn add @file-services/utils
Then, use the programmatic API:
import { nodeFs } from '@file-services/node'
import { createDirectoryFs } from '@file-services/utils'
const directoryFs = createDirectoryFs(nodeFs, '/path/to/some/folder')
directoryFs.writeFileSync('/file.js', 'SAMPLE')
directoryFs.readFileSync('/file.js')