Comparing version 0.26.5 to 0.26.6
@@ -0,1 +1,5 @@ | ||
0.26.6 / 2016-03-25 | ||
------------------- | ||
- fixed if `emptyDir()` does not have a callback: [#229][#229] | ||
0.26.5 / 2016-01-27 | ||
@@ -2,0 +6,0 @@ ------------------- |
@@ -7,2 +7,3 @@ var fs = require('fs') | ||
function emptyDir (dir, callback) { | ||
callback = callback || function () {} | ||
fs.readdir(dir, function (err, items) { | ||
@@ -9,0 +10,0 @@ if (err) return mkdir.mkdirs(dir, callback) |
{ | ||
"name": "fs-extra", | ||
"version": "0.26.5", | ||
"version": "0.26.6", | ||
"description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/jprichardson/node-fs-extra", |
@@ -64,7 +64,31 @@ Node.js: fs-extra | ||
Sync vs Async | ||
------------- | ||
Most methods are async by default (they take a callback with an `Error` as first argument). | ||
Sync methods on the other hand will throw if an error occurs. | ||
Example: | ||
```js | ||
var fs = require('fs-extra') | ||
fs.copy('/tmp/myfile', '/tmp/mynewfile', function (err) { | ||
if (err) return console.error(err) | ||
console.log("success!") | ||
}); | ||
try { | ||
fs.copySync('/tmp/myfile', '/tmp/mynewfile') | ||
console.log("success!") | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
``` | ||
Methods | ||
------- | ||
- [copy](#copy) | ||
- [copySync](#copysync) | ||
- [copySync](#copy) | ||
- [createOutputStream](#createoutputstreamfile-options) | ||
@@ -84,6 +108,6 @@ - [emptyDir](#emptydirdir-callback) | ||
- [move](#movesrc-dest-options-callback) | ||
- [outputFile](#outputfilefile-data-callback) | ||
- [outputFileSync](#outputfilefile-data-callback) | ||
- [outputJson](#outputjsonfile-data-callback) | ||
- [outputJsonSync](#outputjsonfile-data-callback) | ||
- [outputFile](#outputfilefile-data-options-callback) | ||
- [outputFileSync](#outputfilefile-data-options-callback) | ||
- [outputJson](#outputjsonfile-data-options-callback) | ||
- [outputJsonSync](#outputjsonfile-data-options-callback) | ||
- [readJson](#readjsonfile-options-callback) | ||
@@ -109,6 +133,8 @@ - [readJsonSync](#readjsonfile-options-callback) | ||
Options: | ||
clobber (boolean): overwrite existing file or directory | ||
preserveTimestamps (boolean): will set last modification and access times to the ones of the original source files, default is `false`. | ||
filter: Function or RegExp to filter copied files. If function, return true to include, false to exclude. If RegExp, same as function, where `filter` is `filter.test`. | ||
- clobber (boolean): overwrite existing file or directory | ||
- preserveTimestamps (boolean): will set last modification and access times to the ones of the original source files, default is `false`. | ||
- filter: Function or RegExp to filter copied files. If function, return true to include, false to exclude. If RegExp, same as function, where `filter` is `filter.test`. | ||
Sync: `copySync()` | ||
Example: | ||
@@ -130,23 +156,2 @@ | ||
### copySync() | ||
**copySync(src, dest, [options])** | ||
Synchronously copies a file or directory. The directory can have contents. | ||
Example: | ||
```js | ||
var fs = require('fs-extra') | ||
try { | ||
fs.copySync('/tmp/mydir', '/tmp/mynewdir' | ||
} catch (err) { | ||
console.error('Oh no, there was an error: ' + err.message) | ||
} | ||
``` | ||
### createOutputStream(file, [options]) | ||
@@ -173,3 +178,3 @@ | ||
Ensures that a directory is empty. If the directory does not exist, it is created. The directory itself is not deleted. | ||
Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted. | ||
@@ -304,4 +309,4 @@ Alias: `emptydir()` | ||
Options: | ||
clobber (boolean): overwrite existing file or directory | ||
limit (number): number of concurrent moves, see ncp for more information | ||
- clobber (boolean): overwrite existing file or directory | ||
- limit (number): number of concurrent moves, see ncp for more information | ||
@@ -308,0 +313,0 @@ Example: |
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
88462
1113
587