fs-jetpack
Advanced tools
Comparing version 2.2.3 to 2.3.0
@@ -0,1 +1,4 @@ | ||
# 2.3.0 (2020-05-03) | ||
- `inspectTree()` now supports `times` option. | ||
# 2.2.3 (2019-10-21) | ||
@@ -2,0 +5,0 @@ - Amended TypeScript definitions thanks to @orta |
@@ -15,2 +15,3 @@ "use strict"; | ||
relativePath: ["boolean"], | ||
times: ["boolean"], | ||
symlinks: ["string"] | ||
@@ -17,0 +18,0 @@ }); |
{ | ||
"name": "fs-jetpack", | ||
"description": "Better file system API", | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"author": "Jakub Szwacz <jakub@szwacz.com>", | ||
@@ -20,3 +20,3 @@ "dependencies": { | ||
"lint-staged": "^7.2.0", | ||
"mocha": "^5.2.0", | ||
"mocha": "^7.1.2", | ||
"pre-commit": "^1.1.2", | ||
@@ -23,0 +23,0 @@ "prettier": "1.13.5", |
@@ -105,3 +105,3 @@ fs-jetpack [![Build Status](https://travis-ci.org/szwacz/fs-jetpack.svg?branch=master)](https://travis-ci.org/szwacz/fs-jetpack) [![Build status](https://ci.appveyor.com/api/projects/status/er206e91fpuuqf58?svg=true)](https://ci.appveyor.com/project/szwacz/fs-jetpack) [![codecov](https://codecov.io/gh/szwacz/fs-jetpack/branch/master/graph/badge.svg)](https://codecov.io/gh/szwacz/fs-jetpack) | ||
`options` (optional) additional options for customization. Is an `Object` with possible fields: | ||
* `overwrite` (default: `false`) Whether to overwrite destination path when it already exists. Can be `Boolean` or `Function`. For directories, source directory is merged with destination directory. If function was provided, every time there is a file conflict while copying the function will be invoked with [inspect](#inspectpath-options) objects of both: source and destination file and overwrites the file only if `true` has been returned from the function (see example below). In async mode, the overwrite function can also return a promise, so you can perform multi step processes to determine if file should be overwritten or not (see example below). | ||
* `overwrite` (default: `false`) Whether to overwrite destination path when it already exists. Can be `Boolean` or `Function`. If `false`, an error will be thrown if it already exists. If `true`, the overwrite will be performed (for directories, this overwrite consists of a recursive merge - i.e. only files that already exist in the destination directory will be overwritten). If a function was provided, every time there is a file conflict while copying the function will be invoked with [inspect](#inspectpath-options) objects of both: source and destination file and overwrites the file only if `true` has been returned from the function (see example below). In async mode, the overwrite function can also return a promise, so you can perform multi step processes to determine if file should be overwritten or not (see example below). | ||
* `matching` if defined will actually copy **only** items matching any of specified glob patterns and omit everything else ([all possible globs are described further in this readme](#matching-patterns)). | ||
@@ -210,2 +210,4 @@ * `ignoreCase` (default `false`) whether or not case should be ignored when processing glob patterns passed through the `matching` option. | ||
If the given path already exists but is not a directory, an error will be thrown. | ||
**arguments:** | ||
@@ -360,2 +362,3 @@ `path` path to directory to examine. | ||
* `checksum` if specified will also calculate checksum of every item in the tree. Possible values are strings `'md5'`, `'sha1'`, `'sha256'` or `'sha512'`. Checksums for directories are calculated as checksum of all children' checksums plus their filenames (see example below). | ||
* `times` (default `false`) if set to `true` will add atime, mtime and ctime fields (here called `accessTime`, `modifyTime` and `changeTime`) to each tree node. | ||
* `relativePath` if set to `true` every tree node will have relative path anchored to root inspected folder. | ||
@@ -362,0 +365,0 @@ * `symlinks` (default `'report'`) if a given path is a symlink by default `inspectTree` will report that symlink (not follow it). You can flip this behaviour by setting this option to `'follow'`. |
@@ -212,2 +212,31 @@ import * as fse from "fs-extra"; | ||
describe("can output file times (ctime, mtime, atime)", () => { | ||
const preparations = () => { | ||
fse.outputFileSync("dir/file.txt", "abc"); | ||
}; | ||
const expectations = (data: InspectTreeResult) => { | ||
expect(typeof data.accessTime.getTime).to.equal("function"); | ||
expect(typeof data.modifyTime.getTime).to.equal("function"); | ||
expect(typeof data.changeTime.getTime).to.equal("function"); | ||
expect(typeof data.children[0].accessTime.getTime).to.equal("function"); | ||
expect(typeof data.children[0].modifyTime.getTime).to.equal("function"); | ||
expect(typeof data.children[0].changeTime.getTime).to.equal("function"); | ||
}; | ||
it("sync", () => { | ||
preparations(); | ||
expectations(jetpack.inspectTree("dir", { times: true })); | ||
}); | ||
it("async", done => { | ||
preparations(); | ||
jetpack.inspectTreeAsync("dir", { times: true }).then(data => { | ||
expectations(data); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe("respects internal CWD of jetpack instance", () => { | ||
@@ -214,0 +243,0 @@ const preparations = () => { |
@@ -73,2 +73,3 @@ /// <reference types="node" /> | ||
relativePath?: boolean; | ||
times?: boolean; | ||
symlinks?: "report" | "follow"; | ||
@@ -75,0 +76,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
284134
8252
548