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

fs-copy-file

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-copy-file

fs.copyFile ponyfill

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

fs-copy-file License NPM version Dependency Status Build Status Coverage Status

fs.copyFile ponyfill.

Asynchronously copies src to dest. By default, dest is overwritten if it already exists. No arguments other than a possible exception are given to the callback function. flags is an optional integer that specifies the behavior of the copy operation. The only supported flag is COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.

Install

npm i fs-copy-file

API

Create pipe between streams and adds callback wich would be called once whenever everything is done, or error occures.

const copyFile = require('fs-copy-file');

// destination.txt will be created or overwritten by default.
copyFile('source.txt', 'destination.txt', (err) => {
    if (err)
        throw err;
    
    console.log('source.txt was copied to destination.txt');
});

If the third argument is a number, then it specifies flags, as shown in the following example.

const copyFile = require('fs-copy-file');
const { COPYFILE_EXCL } = copyFile.constants;

// By using COPYFILE_EXCL, the operation will fail if destination.txt exists.
fs.copyFile('source.txt', 'destination.txt', COPYFILE_EXCL, callback);

License

MIT

Keywords

FAQs

Package last updated on 13 Sep 2017

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