It would be extremely useful if the list of files copy()d were passed to the callback/then. Even more so when a filter is used.
fs.copy('/tmp/myfile', '/tmp/mynewfile')
.then(files => {
console.log('success!', files.join(', '))
})
not sure! @jprichardson @RyanZim @JPeer264 your thoughts?
@milesj Would it be absolute paths, or relative to the source directory? What about symlinks?
Implementing that is fairly simple! but we have to keep that in mind if we are copying large directories, keeping a big array (that holds file names) may cause memory issues! Just throwing this out here :grin:
@RyanZim @manidlou Figured all this could be configured with an options object (3rd arg?).
Contrived example.
fs.copy('/tmp/myfile', '/tmp/mynewfile', {
absolute: true,
log: true,
})
.then(files => {
console.log('success!', files.join(', '))
});
As a short-term solution, why not just log in filter()? I'm not convinced adding options for this is a good idea. Long-term, I think we need to move to streams or AsyncIterators on these operations.
Not a bad interim solution :P
Closing as future for the time being.
Most helpful comment
As a short-term solution, why not just log in
filter()? I'm not convinced adding options for this is a good idea. Long-term, I think we need to move to streams or AsyncIterators on these operations.