Package detail

@wrote/rm

wrote59MIT1.1.5

A package to remove files and directories.

rm, wrote, filesystem, fs

readme

@wrote/rm

npm version

@wrote/rm is a package to remove files and directories.

yarn add -E @wrote/rm

Table Of Contents

API

The package is available by importing its default function:

import rm from '@wrote/rm'

rm(
  path: string,
): void

Removes a path to either a file or directory.

/* yarn example/ */
import rm from '@wrote/rm'
import clone from '@wrote/clone'
import readDirStructure from '@wrote/read-dir-structure'

const printContent = async (p) => {
  const { content } = await readDirStructure(p)
  console.log(JSON.stringify(content, null, 2))
}

(async () => {
  // 0. SETUP: create a temp directory to remove.
  await clone('example/dir', 'example/temp')
  console.log('Content before:')
  await printContent('example/temp')

  // 1. REMOVE the directory.
  await rm('example/temp/dir')

  // 2. VALIDATE the removal.
  console.log('Content after:')
  await printContent('example/temp')
})()
Content before:
{
  "dir": {
    "content": {
      "example.txt": {
        "type": "File"
      }
    },
    "type": "Directory"
  }
}
Content after:
{}

Copyright

Art Deco © Art Deco for Wrote 2019 Wrote Tech Nation Visa Tech Nation Visa Sucks

changelog

22 April 2019

1.1.5

  • [types] Cast types for GCC:
    • /** @type {!fs.Stats} */
    • Object.keys(/** @type {!Object} */ (content))

18 April 2019

1.1.4

  • [deps] Update and unlock dependencies.

2 April 2019

1.1.3

  • [deps] Update makepromise.

14 January 2019

1.1.2

  • [deps] Update read-dir-structure and makepromise.

14 January 2019

1.1.1

  • [package] Add the "module" field.
  • [package] Remove source maps.

27 September 2018

1.1.0

  • [feature] Remove symlink.

15 September 2018

1.0.0