JSPM

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

fs.move and fs.copy for Node.JS

Package Exports

  • fs.extra

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fs.extra) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fs.extra

Adds fs.move and fs.copy to Node.JS' fs.

var fs = require('fs.extra');

fs.copy

Creates an fs.readStream and fs.writeStream and uses util.pump to efficiently copy.

fs.copy('foo.txt', 'bar.txt', function (err) {
  if (err) {
    throw err;
  }

  console.log("Copied 'foo.txt' to 'bar.txt');
});

fs.move

Attempts fs.rename, then tries fs.copy/fs.unlink before failing.

fs.move('foo.txt', 'bar.txt', function (err) {
  if (err) {
    throw err;
  }

  console.log("Moved 'foo.txt' to 'bar.txt');
});