Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cher-ami/mfs

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cher-ami/mfs

nodejs fs wrapper

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

mfs

mfs (micro-fs) is a nodejs fs wrapper that provides a collection of high-level functions for manipulating files and directories.

Installation

npm install @cher-ami/mfs

Usage

import { * as mfs } from '@cher-ami/mfs';

(async () => {
  // create a new file in a non-existing directory
  await mfs.createFile('/test/foo.txt', 'Hello World');
  const content = await mfs.readFile('/test/foo.txt');
  console.log(content); // -> "Hello World"
})();

API

  • fileExists
function fileExists(path: string): Promise<boolean>
  • createFile
function createFile(path: string, content?: string): Promise<void>
  • readFile
function readFile(path: string): Promise<string>
  • removeFile
function removeFile(path: string): Promise<boolean>
  • copyFile
function copyFile(
  src: string,
  dest: string,
  {
    transform,
    force,
  }: { transform?: (content: string) => Promise<string>; force?: boolean }
): Promise<void>
  • dirExists
function dirExists(path: string): Promise<boolean>
  • readDir
function readDir(path: string, recursive = true): Promise<string[]>
  • removeDir
function removeDir(path: string): Promise<void>
  • createDir
function createDir(path: string): Promise<string | undefined>
  • copyDir
function copyDir(
  src: string,
  dest: string,
  { force }: { force?: boolean } = {}
): Promise<void>

License

MIT

Credits

© Willy Brauner

FAQs

Package last updated on 02 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc