@gmjs/fs-async
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

Async File System Utilities

These are simple file system utilities for Node.js, using Promises.

Installation

npm install --save @gmjs/fs-async

Functions

Basic File System

  • readTextAsync(filePath: string): Promise<string>
    • Description - Read a text file.

  • writeTextAsync(filePath: string, content: string): Promise<void>
    • Description - Write a text file.

  • readBinaryAsync(filePath: string): Promise<Buffer>
    • Description - Read a binary file.

  • writeBinaryAsync(filePath: string, content: Buffer): Promise<void>
    • Description - Write a binary file.

  • createFileAsync(filePath: string): Promise<void>
    • Description
      • Create a file.
      • Often used with writeTextAsync or writeBinaryAsync to ensure that a file and ancestor directories exist before writing to it.

  • existsAsync(filePath: string): Promise<boolean>
    • Description - Check if a file exists.

Find

  • findFileSystemEntriesAsync(directory: string, options?: FindOptions): Promise<readonly FilePathStats[]>
    • Description - Search a directory for files. Search can be limited by depth.
    • Parameters
      • directory: string - The directory to search.
      • options: FindOptions
        • Description - Options for the search.
        • Fields
          • depthLimit: number | undefined:
            • Description
              • The maximum depth to search.
              • Default is undefined.
              • If value is -1 or undefined, there is no depth limit (limit is inifnite).

Readme

Keywords

none

Package Sidebar

Install

npm i @gmjs/fs-async

Weekly Downloads

3

Version

0.0.5

License

MIT

Unpacked Size

8.77 kB

Total Files

10

Last publish

Collaborators

  • mrzli