finki-main
main
|
Last change
on this file since 62b2964 was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
607 bytes
|
| Line | |
|---|
| 1 | const fs = require('./fs.js')
|
|---|
| 2 | const getOptions = require('./common/get-options.js')
|
|---|
| 3 | const owner = require('./common/owner.js')
|
|---|
| 4 |
|
|---|
| 5 | const copyFile = async (src, dest, opts) => {
|
|---|
| 6 | const options = getOptions(opts, {
|
|---|
| 7 | copy: ['mode', 'owner'],
|
|---|
| 8 | wrap: 'mode',
|
|---|
| 9 | })
|
|---|
| 10 |
|
|---|
| 11 | const { uid, gid } = await owner.validate(dest, options.owner)
|
|---|
| 12 |
|
|---|
| 13 | // the node core method as of 16.5.0 does not support the mode being in an
|
|---|
| 14 | // object, so we have to pass the mode value directly
|
|---|
| 15 | const result = await fs.copyFile(src, dest, options.mode)
|
|---|
| 16 |
|
|---|
| 17 | await owner.update(dest, uid, gid)
|
|---|
| 18 |
|
|---|
| 19 | return result
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | module.exports = copyFile
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.