stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

feat: add `fs/copy-file`

Open HRIDYANSHU054 opened this issue 1 year ago • 3 comments

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.


@stdlib-js/reviewers

HRIDYANSHU054 avatar Apr 23 '24 17:04 HRIDYANSHU054

Hi @Planeshifter could you rerun the CI checks so that I can rectify anything that isn't correct?

HRIDYANSHU054 avatar Apr 25 '24 12:04 HRIDYANSHU054

@kgryte , @Planeshifter could you rerun the CI check

HRIDYANSHU054 avatar Apr 29 '24 12:04 HRIDYANSHU054

/stdlib update-copyright-years

Planeshifter avatar May 19 '24 22:05 Planeshifter