Skip to content

Commit

Permalink
Merge pull request #563 from jprichardson/copy-preserve-timestamps-false
Browse files Browse the repository at this point in the history
copy*() preserveTimestamps: false behavior is OS-dependent
  • Loading branch information
jprichardson committed Apr 7, 2018
2 parents 50c098e + 5170b4f commit bacf504
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/copy-sync.md
Expand Up @@ -8,7 +8,7 @@ Copy a file or directory. The directory can have contents. Like `cp -r`.
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior.
- `errorOnExist` `<boolean>`: when `overwrite` is `false` and the destination exists, throw an error. Default is `false`.
- `dereference` `<boolean>`: dereference symlinks, default is `false`.
- `preserveTimestamps` `<boolean>`: will set last modification and access times to the ones of the original source files, default is `false`.
- `preserveTimestamps` `<boolean>`: When true, will set last modification and access times to the ones of the original source files. When false, timestamp behavior is OS-dependent. Default is `false`.
- `filter` `<Function>`: Function to filter copied files. Return `true` to include, `false` to exclude.

## Example:
Expand Down
2 changes: 1 addition & 1 deletion docs/copy.md
Expand Up @@ -8,7 +8,7 @@ Copy a file or directory. The directory can have contents. Like `cp -r`.
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior.
- `errorOnExist` `<boolean>`: when `overwrite` is `false` and the destination exists, throw an error. Default is `false`.
- `dereference` `<boolean>`: dereference symlinks, default is `false`.
- `preserveTimestamps` `<boolean>`: will set last modification and access times to the ones of the original source files, default is `false`.
- `preserveTimestamps` `<boolean>`: When true, will set last modification and access times to the ones of the original source files. When false, timestamp behavior is OS-dependent. Default is `false`.
- `filter` `<Function>`: Function to filter copied files. Return `true` to include, `false` to exclude. Can also return a `Promise` that resolves to `true` or `false` (or pass in an `async` function).
- `callback` `<Function>`

Expand Down
10 changes: 0 additions & 10 deletions lib/copy-sync/__tests__/copy-sync-preserve-time.test.js
Expand Up @@ -29,16 +29,6 @@ describeIfPractical('copySync() - preserveTimestamps option', () => {

afterEach(done => fs.remove(TEST_DIR, done))

describe('> when preserveTimestamps option is false', () => {
it('should have different timestamps on copy', done => {
setTimeout(() => {
fs.copySync(SRC, DEST, {preserveTimestamps: false})
FILES.forEach(testFile({preserveTimestamps: false}))
done()
}, 100)
})
})

describe('> when preserveTimestamps option is true', () => {
it('should have the same timestamps on copy', () => {
fs.copySync(SRC, DEST, {preserveTimestamps: true})
Expand Down
11 changes: 0 additions & 11 deletions lib/copy/__tests__/copy-preserve-time.test.js
Expand Up @@ -30,17 +30,6 @@ describeIfPractical('copy() - preserve timestamp', () => {

afterEach(done => fs.remove(TEST_DIR, done))

describe('> when timestamp option is false', () => {
it('should have different timestamps on copy', done => {
setTimeout(() => {
copy(SRC, DEST, {preserveTimestamps: false}, () => {
FILES.forEach(testFile({preserveTimestamps: false}))
done()
})
}, 100)
})
})

describe('> when timestamp option is true', () => {
it('should have the same timestamps on copy', done => {
copy(SRC, DEST, {preserveTimestamps: true}, () => {
Expand Down

0 comments on commit bacf504

Please sign in to comment.