stdlib
stdlib copied to clipboard
feat: add `fs/copy-file`
adds file system copy file utility to Stdlib
Description
What is the purpose of this pull request?
This pull request:
is aligned with the purpose of achievinng feature parity with Node.js fs package. It Brings file system's powerful copy file utility to Stdlib expanding its existing fs utilities. It also tends to make the copy File utility version independent for node. Moreover, with this I also wish to know with what approach do we further add abstractions over the fs utilities.
Questions
Any questions for reviewers of this pull request?
No.
Other
Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.
Implementation details
-- async version
function onCopy( error ) {
if ( error ) {
throw error;
}
console.log( 'src.txt has been copied to dest.txt' );
}
copyFile( 'src.txt', 'dest.txt', onCopy );
-- sync version
var copyFile = require( '@stdlib/fs/copy-file' );
// Explicitly handle the error...
var err = copyFileSync( 'src.txt', 'dest.txt' );
if ( err instanceof Error ) {
throw err;
}
more --> currently researching on how fs/constants could be implemented for stdlibsuch that further feature parity and version independency are achievable.
Checklist
Please ensure the following tasks are completed before submitting this pull request.
- [x] Read, understood, and followed the contributing guidelines.
@stdlib-js/reviewers
Hi @Planeshifter could you rerun the CI checks so that I can rectify anything that isn't correct?
@kgryte , @Planeshifter could you rerun the CI check
/stdlib update-copyright-years