mirror of
https://github.com/denoland/deno.git
synced 2024-11-23 15:16:54 -05:00
1 line
13 KiB
JSON
1 line
13 KiB
JSON
{"name":"fs-extra","description":"fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.","dist-tags":{"latest":"10.1.0"},"versions":{"10.1.0":{"name":"fs-extra","version":"10.1.0","description":"fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.","engines":{"node":">=12"},"repository":{"type":"git","url":"git+https://github.com/jprichardson/node-fs-extra.git"},"author":{"name":"JP Richardson","email":"jprichardson@gmail.com"},"license":"MIT","dependencies":{"graceful-fs":"^4.2.0","jsonfile":"^6.0.1","universalify":"^2.0.0"},"devDependencies":{"at-least-node":"^1.0.0","klaw":"^2.1.1","klaw-sync":"^3.0.2","minimist":"^1.1.1","mocha":"^5.0.5","nyc":"^15.0.0","proxyquire":"^2.0.1","read-dir-files":"^0.1.1","standard":"^16.0.3"},"main":"./lib/index.js","scripts":{"lint":"standard","test-find":"find ./lib/**/__tests__ -name *.test.js | xargs mocha","test":"npm run lint && npm run unit","unit":"nyc node test.js"},"sideEffects":false,"gitHead":"0220eac966d7d6b9a595d69b1242ab8a397fba7f","bugs":{"url":"https://github.com/jprichardson/node-fs-extra/issues"},"_id":"fs-extra@10.1.0","_nodeVersion":"16.9.1","_npmVersion":"7.21.1","dist":{"integrity":"sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==","shasum":"02873cfbc4084dde127eaa5f9905eef2325d1abf","tarball":"http://localhost:4260/fs-extra/fs-extra-10.1.0.tgz","fileCount":31,"unpackedSize":63278,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD21YYPPgkB2LOeQWvg8lrG4HDMrcyGDuHGzHSgb4C7JQIgFvAy28pTBl3wREOhOiLoYEyQzj6nz63aExuHO6pZiH8="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiWxA2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqPvQ//amNoBcS9NyvKrd0yF+0y7J+Gli5ei+B3cxmsB8XvtId4ZpOj\r\n/uvQmMvyKe6/jx/WnGyiSDRC+51WEPnMr1hxaxwhsik+lefDR7cCrjjdRaB6\r\nTE50qqcXzHIcgOWWY9jmOjbcyvmMUj2BECmSKkJHZu7xYAwZgLakphXul8tL\r\nLoCSYEolCIwsbYjrUdcrTTNnpkBIr8a+Xrr3H85yhnPG0itZhiYfFzNIUabq\r\nP0ztUOSW6MvfObUWX5dMU9XeykTFRhCgsp7zEWIVlXENpErkFoPSNxMKxDte\r\nu55LF7wBpK2fhtsjurNvEN3KN41uI+xeCs/ilWn1lYDWXBAzmNZckn+qLxb/\r\nLinE2yGykmRdqF3l73EcxcU91Y+riUEA8nuH4KNQLHnkvZM+Vh+cWVM8knek\r\nfgPAy0Tg6W1oh/Il8W2TIFrcMar6AWNrsUt4TJEfYRpLrDNLvjP7afTZNF0i\r\nyPGbNVO8J9UFUk2eTrMwcm2107HdVcb+5rVxdptFeh5o9nLqznzetia4WNCY\r\n9tfgeTLhhEiv5igA3lqQTrOPE8YUJ1IQLzuFscy0QEWwdJTCmGAbWDP6xhfd\r\nbjkN0ArzH8T1vdlKBZmmdWDeq1jq0q9JPIGqcXKAT659smnMhCrw8rWRidTE\r\nsVCOU4zwwfjWMOwXAxyyDwk6lOHXIFRnRQg=\r\n=dBd9\r\n-----END PGP SIGNATURE-----\r\n"},"directories":{},"_hasShrinkwrap":false}},"readme":"Node.js: fs-extra\n=================\n\n`fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It also uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to prevent `EMFILE` errors. It should be a drop in replacement for `fs`.\n\n[![npm Package](https://img.shields.io/npm/v/fs-extra.svg)](https://www.npmjs.org/package/fs-extra)\n[![License](https://img.shields.io/npm/l/fs-extra.svg)](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE)\n[![build status](https://img.shields.io/github/workflow/status/jprichardson/node-fs-extra/Node.js%20CI/master)](https://github.com/jprichardson/node-fs-extra/actions/workflows/ci.yml?query=branch%3Amaster)\n[![downloads per month](http://img.shields.io/npm/dm/fs-extra.svg)](https://www.npmjs.org/package/fs-extra)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\nWhy?\n----\n\nI got tired of including `mkdirp`, `rimraf`, and `ncp` in most of my projects.\n\n\n\n\nInstallation\n------------\n\n npm install fs-extra\n\n\n\nUsage\n-----\n\n`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed.\n\nYou don't ever need to include the original `fs` module again:\n\n```js\nconst fs = require('fs') // this is no longer necessary\n```\n\nyou can now do this:\n\n```js\nconst fs = require('fs-extra')\n```\n\nor if you prefer to make it clear that you're using `fs-extra` and not `fs`, you may want\nto name your `fs` variable `fse` like so:\n\n```js\nconst fse = require('fs-extra')\n```\n\nyou can also keep both, but it's redundant:\n\n```js\nconst fs = require('fs')\nconst fse = require('fs-extra')\n```\n\nSync vs Async vs Async/Await\n-------------\nMost methods are async by default. All async methods will return a promise if the callback isn't passed.\n\nSync methods on the other hand will throw if an error occurs.\n\nAlso Async/Await will throw an error if one occurs.\n\nExample:\n\n```js\nconst fs = require('fs-extra')\n\n// Async with promises:\nfs.copy('/tmp/myfile', '/tmp/mynewfile')\n .then(() => console.log('success!'))\n .catch(err => console.error(err))\n\n// Async with callbacks:\nfs.copy('/tmp/myfile', '/tmp/mynewfile', err => {\n if (err) return console.error(err)\n console.log('success!')\n})\n\n// Sync:\ntry {\n fs.copySync('/tmp/myfile', '/tmp/mynewfile')\n console.log('success!')\n} catch (err) {\n console.error(err)\n}\n\n// Async/Await:\nasync function copyFiles () {\n try {\n await fs.copy('/tmp/myfile', '/tmp/mynewfile')\n console.log('success!')\n } catch (err) {\n console.error(err)\n }\n}\n\ncopyFiles()\n```\n\n\nMethods\n-------\n\n### Async\n\n- [copy](docs/copy.md)\n- [emptyDir](docs/emptyDir.md)\n- [ensureFile](docs/ensureFile.md)\n- [ensureDir](docs/ensureDir.md)\n- [ensureLink](docs/ensureLink.md)\n- [ensureSymlink](docs/ensureSymlink.md)\n- [mkdirp](docs/ensureDir.md)\n- [mkdirs](docs/ensureDir.md)\n- [move](docs/move.md)\n- [outputFile](docs/outputFile.md)\n- [outputJson](docs/outputJson.md)\n- [pathExists](docs/pathExists.md)\n- [readJson](docs/readJson.md)\n- [remove](docs/remove.md)\n- [writeJson](docs/writeJson.md)\n\n### Sync\n\n- [copySync](docs/copy-sync.md)\n- [emptyDirSync](docs/emptyDir-sync.md)\n- [ensureFileSync](docs/ensureFile-sync.md)\n- [ensureDirSync](docs/ensureDir-sync.md)\n- [ensureLinkSync](docs/ensureLink-sync.md)\n- [ensureSymlinkSync](docs/ensureSymlink-sync.md)\n- [mkdirpSync](docs/ensureDir-sync.md)\n- [mkdirsSync](docs/ensureDir-sync.md)\n- [moveSync](docs/move-sync.md)\n- [outputFileSync](docs/outputFile-sync.md)\n- [outputJsonSync](docs/outputJson-sync.md)\n- [pathExistsSync](docs/pathExists-sync.md)\n- [readJsonSync](docs/readJson-sync.md)\n- [removeSync](docs/remove-sync.md)\n- [writeJsonSync](docs/writeJson-sync.md)\n\n\n**NOTE:** You can still use the native Node.js methods. They are promisified and copied over to `fs-extra`. See [notes on `fs.read()`, `fs.write()`, & `fs.writev()`](docs/fs-read-write-writev.md)\n\n### What happened to `walk()` and `walkSync()`?\n\nThey were removed from `fs-extra` in v2.0.0. If you need the functionality, `walk` and `walkSync` are available as separate packages, [`klaw`](https://github.com/jprichardson/node-klaw) and [`klaw-sync`](https://github.com/manidlou/node-klaw-sync).\n\n\nThird Party\n-----------\n\n### CLI\n\n[fse-cli](https://www.npmjs.com/package/@atao60/fse-cli) allows you to run `fs-extra` from a console or from [npm](https://www.npmjs.com) scripts.\n\n### TypeScript\n\nIf you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra\n\n\n### File / Directory Watching\n\nIf you want to watch for changes to files or directories, then you should use [chokidar](https://github.com/paulmillr/chokidar).\n\n### Obtain Filesystem (Devices, Partitions) Information\n\n[fs-filesystem](https://github.com/arthurintelligence/node-fs-filesystem) allows you to read the state of the filesystem of the host on which it is run. It returns information about both the devices and the partitions (volumes) of the system.\n\n### Misc.\n\n- [fs-extra-debug](https://github.com/jdxcode/fs-extra-debug) - Send your fs-extra calls to [debug](https://npmjs.org/package/debug).\n- [mfs](https://github.com/cadorn/mfs) - Monitor your fs-extra calls.\n\n\n\nHacking on fs-extra\n-------------------\n\nWanna hack on `fs-extra`? Great! Your help is needed! [fs-extra is one of the most depended upon Node.js packages](http://nodei.co/npm/fs-extra.png?downloads=true&downloadRank=true&stars=true). This project\nuses [JavaScript Standard Style](https://github.com/feross/standard) - if the name or style choices bother you,\nyou're gonna have to get over it :) If `standard` is good enough for `npm`, it's good enough for `fs-extra`.\n\n[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n\nWhat's needed?\n- First, take a look at existing issues. Those are probably going to be where the priority lies.\n- More tests for edge cases. Specifically on different platforms. There can never be enough tests.\n- Improve test coverage.\n\nNote: If you make any big changes, **you should definitely file an issue for discussion first.**\n\n### Running the Test Suite\n\nfs-extra contains hundreds of tests.\n\n- `npm run lint`: runs the linter ([standard](http://standardjs.com/))\n- `npm run unit`: runs the unit tests\n- `npm test`: runs both the linter and the tests\n\n\n### Windows\n\nIf you run the tests on the Windows and receive a lot of symbolic link `EPERM` permission errors, it's\nbecause on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's\naccount by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7\nHowever, I didn't have much luck doing this.\n\nSince I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows.\nI open the `Node.js command prompt` and run as `Administrator`. I then map the network drive running the following command:\n\n net use z: \"\\\\vmware-host\\Shared Folders\"\n\nI can then navigate to my `fs-extra` directory and run the tests.\n\n\nNaming\n------\n\nI put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here:\n\n* https://github.com/jprichardson/node-fs-extra/issues/2\n* https://github.com/flatiron/utile/issues/11\n* https://github.com/ryanmcgrath/wrench-js/issues/29\n* https://github.com/substack/node-mkdirp/issues/17\n\nFirst, I believe that in as many cases as possible, the [Node.js naming schemes](http://nodejs.org/api/fs.html) should be chosen. However, there are problems with the Node.js own naming schemes.\n\nFor example, `fs.readFile()` and `fs.readdir()`: the **F** is capitalized in *File* and the **d** is not capitalized in *dir*. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: `fs.mkdir()`, `fs.rmdir()`, `fs.chown()`, etc.\n\nWe have a dilemma though. How do you consistently name methods that perform the following POSIX commands: `cp`, `cp -r`, `mkdir -p`, and `rm -rf`?\n\nMy perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too.\n\nSo, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`.\n\n\nCredit\n------\n\n`fs-extra` wouldn't be possible without using the modules from the following authors:\n\n- [Isaac Shlueter](https://github.com/isaacs)\n- [Charlie McConnel](https://github.com/avianflu)\n- [James Halliday](https://github.com/substack)\n- [Andrew Kelley](https://github.com/andrewrk)\n\n\n\n\nLicense\n-------\n\nLicensed under MIT\n\nCopyright (c) 2011-2017 [JP Richardson](https://github.com/jprichardson)\n\n[1]: http://nodejs.org/docs/latest/api/fs.html\n\n\n[jsonfile]: https://github.com/jprichardson/node-jsonfile\n","author":{"name":"JP Richardson","email":"jprichardson@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/jprichardson/node-fs-extra.git"},"homepage":"https://github.com/jprichardson/node-fs-extra","bugs":{"url":"https://github.com/jprichardson/node-fs-extra/issues"},"readmeFilename":"README.md","license":"MIT"}
|