JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 320
  • Score
    100M100P100Q85785F
  • License MIT

Link and unlink with saving and restoring the previous file or directory

Package Exports

  • link-unlink

Readme

Link and unlink with saving and restoring the previous file or directory

import { link, unlink } from 'link-unlink';

// if '/path/to/link' exists, it is moved to '/path/to/link.abcde1234' and regardless '/path/to/file_or_folder' -> '/path/to/link'
await link('/path/to/file_or_folder', '/path/to/link'); 

// if '/path/to/link.abcde1234' exists, it is restored to '/path/to/link' otherwise it will be removed
await unlink('/path/to/link'); 

Documentation

API Docs