removeSync() on Windows, in some cases, it would error out with ENOTEMPTY (#646)mode option for ensureDir*() (#587)copy*() handling of symlinks to properly detect symlinks that point to the same file. (#582)fs.lchmod() (#596)engines field to package.json (#580)fs.promises ExperimentalWarning on Node v10.1.0 (#578)move to use fs.rename where possible (#549)filter (#554)copy*'s behavior when preserveTimestamps is false has been OS-dependent since 5.0.0, but that's now explicitly noted in the docs (#563)copy* & move* (#541)copy* (#568)Significant refactor of copy() & copySync(), including breaking changes. No changes to other functions in this release.
Huge thanks to @manidlou for doing most of the work on this release.
filter option can no longer be a RegExp (must be a function). This was deprecated since fs-extra v1.0.0. #512copy()'s filter option can now be a function that returns a Promise. #518copy() & copySync() now use fs.copyFile()/fs.copyFileSync() in environments that support it (currently Node 8.5.0+). Older Node versions still get the old implementation. #505dest's parent if the filter function aborts the copy() operation. #517writeStream not being closed if there was an error in copy(). #516chmod values in fs.remove() #501TypeError on systems that don't have some fs operations like lchown #520EOL option to writeJson* & outputJson* (via upgrade to jsonfile v4)fs.copyFile() in Node 8.5+.js extension to main field in package.json for better tooling compatibility. #485ensureFile() & ensureFileSync() would do nothing if the path was a directory. Now, they error out for consistency with ensureDir(). #465, #466, #470fs.read() & fs.write() now return objects. See the docs for details. #436, #449fs.move() now errors out when destination is a subdirectory of source. #458rimraf to fs.remove() & fs.removeSync(). #459fs.outputJSONSync() working again; it was broken due to refactoring. #428Also clarified the docs in a few places.
move() & moveSync() when source and destination are the same, and source does not exist. #415pathExists(), a replacement for the deprecated fs.exists. pathExists has a normal error-first callback signature. Also added pathExistsSync, an alias to fs.existsSync, for completeness. #406writeJson(), writeJsonSync(), outputJson(), & outputJsonSync(). This was undocumented. #402throws option for readJsonSync(); now does not throw filesystem errors when throws is false.writeJson(), writeJsonSync(), outputJson(), & outputJsonSync() now output minified JSON by default for consistency with JSON.stringify(); set the spaces option to 2 to override this new behavior. #402Buffer.allocUnsafe() instead of new Buffer() in environments that support it. #394removeSync() silently failed on Windows in some cases. Now throws an EBUSY error. #408ensureDir()'s callback being called twice in some cases. This bug may have also affected remove(). See #392, #3935597bd, this broke compatibility with Node.js versions v4+ but less than v4.5.0.Buffer.alloc() usage in moveSync().Thanks to Mani Maghsoudlou (@manidlou) & Jan Peer Stöcklmair (@JPeer264) for their extraordinary help with this release!
moveSync() See #309, #381. (@manidlou)copy() and copySync()'s filter option now gets the destination path passed as the second parameter. #366 (@manidlou)Buffer.alloc() instead of deprecated new Buffer() in copySync(). #380 (@manidlou)v0.12. The Node foundation stopped officially supporting itwalk() and walkSync(). walkSync() was only part of fs-extra for a littlewalk(), in fact, walk() was justwalkSync() use klaw-sync. See: #338, #339clobber to overwrite. This affects copy(), copySync(), and move(). #330, #333docs/. #340copySync() like in copy(). #324copy() can fail. #326After five years of development, we finally have reach the 1.0.0 milestone! Big thanks goes
to Ryan Zim for leading the charge on this release!
walkSync()rimaf globbing, wasn't used. #280copy()/copySync() option filter if it's a RegExp. filter should now be a function.rimraf. This is temporary and was done because rimraf depended upon the beefy glob which fs-extra does not use. #300utimesMillis() #271copySync() failed if user didn't own file. #199, #301ensureLink()/ensureSymlink(). Node v0.12 is still supported but will be dropped in the near future as well.createOutputStream(). Use https://www.npmjs.com/package/create-output-stream. See: #192mkdirs()/mkdirsSync() check for invalid win32 path chars. See: #209, #237mkdirs()/mkdirsSync() if drive not mounted, error. See: #93dereference option to copySync(). #235copy() if source and dest are the same. #230emptyDir() does not have a callback: #229copy() with two arguments (w/o callback) was broken. See: #215copySync() made preserveTimestamps default consistent with copy() which is false. See: #208copy() hangup in copying blockDevice / characterDevice / /dev/null. See: #193outputJson{Sync}() spacing adherence to fs.spacescopySync() when clogger=true and the destination is read only. See: #190walk() function into its own module klaw.walk()delete() and deleteSync(). See: #171move() when moving across devices. #170ensureSymlink() and ensureLink() should not throw errors if link exists. #169ensureLink{Sync}() and ensureSymlink{Sync}(). See: #165hasMillisResSync() on module load. See: #149.0.21.0.copy(). See: #54copy() and copySync(). See: #141graceful-fs@3.x to 4.x. This brings in features from amazing-graceful-fs (much cleaner code / less hacks)jsonfile aliases with File in the name, they weren't documented and probably weren't in use e.g.fs.readJsonFile and fs.readJson that were aliases to each other, now use fs.readJson.jsonfile@2.1.0, can now pass JSON revivers/replacers to readJson(), writeJson(), outputJson()fs.copy() had support for Node v0.8, dropped supportEEXIST when clobbering on some Linux systems. #134F_OK (#120)move() a bit. https://github.com/jprichardson/node-fs-extra/commit/92838980f25dc2ee4ec46b43ee14d3c4a1d30c1bemptyDir() and emptyDirSync()copySync added clobber option (before always would clobber, now if clobber is false it throws an error if the destination exists).createOutputStream() added. See: #118fs.move when clobber is true and destination is a directory, it should clobber. #114fs.mkdirs fix infinite loop on Windows. See: See https://github.com/substack/node-mkdirp/pull/74 and https://github.com/substack/node-mkdirp/issues/66fs.copy for Node v0.8 (support is temporary and will be removed in the near future)setImmediate is not available, fall back to process.nextTickfs.move() into itself. Closes #104fs.move() moving directory across device. Closes #108fs.copy() bug. Closes #98ncp, imported code inio.jsgraceful-fs is now a dependencycopy/copySync from fs.copy(src, dest, [filters], callback) to fs.copy(src, dest, [options], callback) #100touch and touchSync methods (they didn't handle permissions like UNIX touch)"ncp": "^0.6.0" to "ncp": "^1.0.1"mkdirp => minimist and mkdirp are no longer dependences, should now appease people who wanted mkdirp to be --use_strict safe. See #59copySync() #85copySync() preserve file permissions #80"ncp": "^0.5.1" to "ncp": "^0.6.0"jsonfile": "^1.2.0" to jsonfile": "^2.0.0" => on write, json files now have \n at end. Also adds options.throws to readJsonSync()"jsonfile": "~1.1.0" to "jsonfile": "^1.2.0", bumped minor because of jsonfile dep change~ to ^. #670.8.x support, 0.9.0 was published moments ago and should have been done therencp from ~0.4.2 to ^0.5.1, #58rimraf from ~2.2.6 to ^2.2.8mkdirp from 0.3.x to ^0.5.0ensureFile(), ensureFileSync()ensureDir(), ensureDirSync() #31move() method. From: https://github.com/andrewrk/node-mvfilter implemented on copy() and copySync(). (Srirangan / #36)copySync() implemented (Srirangan / #33)jsonfile version 1.1.0 which gives options params for the JSON methods. Closes #32copy() now works if destination directory does not exist. Closes #29homepage field in package.json to remove NPM warning4 to 2 to follow Node conventionsjsonfile deprimraf depncp and rimraf.graceful-fs support. Closes #17readTextFile.readJSONFile to readJSON and readJson, same with write.jsonfile from 4 to 2.testutil deps for tests.touch() to createFile()outputFile() and outputFileSync()readTextFile() and readTextFileSync().touch() and touchSync() methods.mkdir to mkdirs/mkdirp.rimraf dep.readJSONFile.deleteSync() didn't exist.remove()/delete() that wouldn't execute the function if a callback wasn't passed.copyFile() to copy(). copy() can now copy directories (recursively) too.rmrf() to remove().remove() aliased with delete().mkdirp capabilities. Named: mkdir(). Hides Node.js native mkdir().fs module with new functions, I now copy over the native methods to a new object and export that instead.