fca-shadow 0.0.1-security → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fca-shadow might be problematic. Click here for more details.
- package/.1obgge4cxlazf1346921747~ +0 -0
- package/CHANGELOG.md +2 -0
- package/DOCS.md +1738 -0
- package/GetThreads/GetThreadInfo.js +128 -0
- package/GetThreads/Last-Run.js +65 -0
- package/LICENSE-MIT +21 -0
- package/README.md +132 -3
- package/StateCrypt.js +96 -0
- package/broadcast.js +22 -0
- package/index.html +1200 -0
- package/index.js +684 -0
- package/languages/index.json +150 -0
- package/lib/getInfoNew.js +34 -0
- package/lib/getToken.js +44 -0
- package/logger.js +23 -0
- package/package/database/SyntheticDatabase.sqlite +0 -0
- package/package/database/index.js +358 -0
- package/package/database/node_modules/lodash/_baseGet/README.md +20 -0
- package/package/database/node_modules/lodash/_baseGet/index.js +74 -0
- package/package/database/node_modules/lodash/_baseGet/package.json +18 -0
- package/package/database/node_modules/lodash/add.js +22 -0
- package/package/database/node_modules/lodash/after.js +42 -0
- package/package/database/node_modules/lodash/array.js +67 -0
- package/package/database/node_modules/lodash/ary.js +29 -0
- package/package/database/node_modules/lodash/assign.js +58 -0
- package/package/database/node_modules/lodash/assignIn.js +40 -0
- package/package/database/node_modules/lodash/assignInWith.js +38 -0
- package/package/database/node_modules/lodash/assignWith.js +37 -0
- package/package/database/node_modules/lodash/at.js +23 -0
- package/package/database/node_modules/lodash/attempt.js +35 -0
- package/package/database/node_modules/lodash/before.js +40 -0
- package/package/database/node_modules/lodash/bind.js +57 -0
- package/package/database/node_modules/lodash/bindAll.js +41 -0
- package/package/database/node_modules/lodash/bindKey.js +68 -0
- package/package/database/node_modules/lodash/camelCase.js +29 -0
- package/package/database/node_modules/lodash/capitalize.js +23 -0
- package/package/database/node_modules/lodash/castArray.js +44 -0
- package/package/database/node_modules/lodash/ceil.js +26 -0
- package/package/database/node_modules/lodash/chain.js +38 -0
- package/package/database/node_modules/lodash/chunk.js +50 -0
- package/package/database/node_modules/lodash/clamp.js +39 -0
- package/package/database/node_modules/lodash/clone.js +36 -0
- package/package/database/node_modules/lodash/cloneDeep.js +29 -0
- package/package/database/node_modules/lodash/cloneDeepWith.js +40 -0
- package/package/database/node_modules/lodash/cloneWith.js +42 -0
- package/package/database/node_modules/lodash/collection.js +30 -0
- package/package/database/node_modules/lodash/commit.js +33 -0
- package/package/database/node_modules/lodash/compact.js +31 -0
- package/package/database/node_modules/lodash/concat.js +43 -0
- package/package/database/node_modules/lodash/cond.js +60 -0
- package/package/database/node_modules/lodash/conforms.js +35 -0
- package/package/database/node_modules/lodash/conformsTo.js +32 -0
- package/package/database/node_modules/lodash/constant.js +26 -0
- package/package/database/node_modules/lodash/core.js +3877 -0
- package/package/database/node_modules/lodash/core.min.js +29 -0
- package/package/database/node_modules/lodash/countBy.js +40 -0
- package/package/database/node_modules/lodash/create.js +43 -0
- package/package/database/node_modules/lodash/curry.js +57 -0
- package/package/database/node_modules/lodash/curryRight.js +54 -0
- package/package/database/node_modules/lodash/date.js +3 -0
- package/package/database/node_modules/lodash/debounce.js +191 -0
- package/package/database/node_modules/lodash/deburr.js +45 -0
- package/package/database/node_modules/lodash/defaultTo.js +25 -0
- package/package/database/node_modules/lodash/defaults.js +64 -0
- package/package/database/node_modules/lodash/defaultsDeep.js +30 -0
- package/package/database/node_modules/lodash/defer.js +26 -0
- package/package/database/node_modules/lodash/delay.js +28 -0
- package/package/database/node_modules/lodash/difference.js +33 -0
- package/package/database/node_modules/lodash/differenceBy.js +44 -0
- package/package/database/node_modules/lodash/differenceWith.js +40 -0
- package/package/database/node_modules/lodash/divide.js +22 -0
- package/package/database/node_modules/lodash/drop.js +38 -0
- package/package/database/node_modules/lodash/dropRight.js +39 -0
- package/package/database/node_modules/lodash/dropRightWhile.js +45 -0
- package/package/database/node_modules/lodash/dropWhile.js +45 -0
- package/package/database/node_modules/lodash/each.js +1 -0
- package/package/database/node_modules/lodash/eachRight.js +1 -0
- package/package/database/node_modules/lodash/endsWith.js +43 -0
- package/package/database/node_modules/lodash/entries.js +1 -0
- package/package/database/node_modules/lodash/entriesIn.js +1 -0
- package/package/database/node_modules/lodash/eq.js +37 -0
- package/package/database/node_modules/lodash/escape.js +43 -0
- package/package/database/node_modules/lodash/escapeRegExp.js +32 -0
- package/package/database/node_modules/lodash/every.js +56 -0
- package/package/database/node_modules/lodash/extend.js +1 -0
- package/package/database/node_modules/lodash/extendWith.js +1 -0
- package/package/database/node_modules/lodash/fill.js +45 -0
- package/package/database/node_modules/lodash/filter.js +52 -0
- package/package/database/node_modules/lodash/find.js +42 -0
- package/package/database/node_modules/lodash/findIndex.js +55 -0
- package/package/database/node_modules/lodash/findKey.js +44 -0
- package/package/database/node_modules/lodash/findLast.js +25 -0
- package/package/database/node_modules/lodash/findLastIndex.js +59 -0
- package/package/database/node_modules/lodash/findLastKey.js +44 -0
- package/package/database/node_modules/lodash/first.js +1 -0
- package/package/database/node_modules/lodash/flake.lock +40 -0
- package/package/database/node_modules/lodash/flake.nix +20 -0
- package/package/database/node_modules/lodash/flatMap.js +29 -0
- package/package/database/node_modules/lodash/flatMapDeep.js +31 -0
- package/package/database/node_modules/lodash/flatMapDepth.js +31 -0
- package/package/database/node_modules/lodash/flatten.js +22 -0
- package/package/database/node_modules/lodash/flattenDeep.js +25 -0
- package/package/database/node_modules/lodash/flattenDepth.js +33 -0
- package/package/database/node_modules/lodash/flip.js +28 -0
- package/package/database/node_modules/lodash/floor.js +26 -0
- package/package/database/node_modules/lodash/flow.js +27 -0
- package/package/database/node_modules/lodash/flowRight.js +26 -0
- package/package/database/node_modules/lodash/forEach.js +41 -0
- package/package/database/node_modules/lodash/forEachRight.js +31 -0
- package/package/database/node_modules/lodash/forIn.js +39 -0
- package/package/database/node_modules/lodash/forInRight.js +37 -0
- package/package/database/node_modules/lodash/forOwn.js +36 -0
- package/package/database/node_modules/lodash/forOwnRight.js +34 -0
- package/package/database/node_modules/lodash/fp/F.js +1 -0
- package/package/database/node_modules/lodash/fp/add.js +5 -0
- package/package/database/node_modules/lodash/fp/after.js +5 -0
- package/package/database/node_modules/lodash/fp/all.js +1 -0
- package/package/database/node_modules/lodash/fp/allPass.js +1 -0
- package/package/database/node_modules/lodash/fp/always.js +1 -0
- package/package/database/node_modules/lodash/fp/any.js +1 -0
- package/package/database/node_modules/lodash/fp/anyPass.js +1 -0
- package/package/database/node_modules/lodash/fp/apply.js +1 -0
- package/package/database/node_modules/lodash/fp/array.js +2 -0
- package/package/database/node_modules/lodash/fp/ary.js +5 -0
- package/package/database/node_modules/lodash/fp/assign.js +5 -0
- package/package/database/node_modules/lodash/fp/assignAll.js +5 -0
- package/package/database/node_modules/lodash/fp/assignAllWith.js +5 -0
- package/package/database/node_modules/lodash/fp/assignIn.js +5 -0
- package/package/database/node_modules/lodash/fp/assignInAll.js +5 -0
- package/package/database/node_modules/lodash/fp/assignInAllWith.js +5 -0
- package/package/database/node_modules/lodash/fp/assignInWith.js +5 -0
- package/package/database/node_modules/lodash/fp/assignWith.js +5 -0
- package/package/database/node_modules/lodash/fp/assoc.js +1 -0
- package/package/database/node_modules/lodash/fp/assocPath.js +1 -0
- package/package/database/node_modules/lodash/fp/at.js +5 -0
- package/package/database/node_modules/lodash/fp/attempt.js +5 -0
- package/package/database/node_modules/lodash/fp/before.js +5 -0
- package/package/database/node_modules/lodash/fp/bind.js +5 -0
- package/package/database/node_modules/lodash/fp/bindAll.js +5 -0
- package/package/database/node_modules/lodash/fp/bindKey.js +5 -0
- package/package/database/node_modules/lodash/fp/camelCase.js +5 -0
- package/package/database/node_modules/lodash/fp/capitalize.js +5 -0
- package/package/database/node_modules/lodash/fp/castArray.js +5 -0
- package/package/database/node_modules/lodash/fp/ceil.js +5 -0
- package/package/database/node_modules/lodash/fp/chain.js +5 -0
- package/package/database/node_modules/lodash/fp/chunk.js +5 -0
- package/package/database/node_modules/lodash/fp/clamp.js +5 -0
- package/package/database/node_modules/lodash/fp/clone.js +5 -0
- package/package/database/node_modules/lodash/fp/cloneDeep.js +5 -0
- package/package/database/node_modules/lodash/fp/cloneDeepWith.js +5 -0
- package/package/database/node_modules/lodash/fp/cloneWith.js +5 -0
- package/package/database/node_modules/lodash/fp/collection.js +2 -0
- package/package/database/node_modules/lodash/fp/commit.js +5 -0
- package/package/database/node_modules/lodash/fp/compact.js +5 -0
- package/package/database/node_modules/lodash/fp/complement.js +1 -0
- package/package/database/node_modules/lodash/fp/compose.js +1 -0
- package/package/database/node_modules/lodash/fp/concat.js +5 -0
- package/package/database/node_modules/lodash/fp/cond.js +5 -0
- package/package/database/node_modules/lodash/fp/conforms.js +1 -0
- package/package/database/node_modules/lodash/fp/conformsTo.js +5 -0
- package/package/database/node_modules/lodash/fp/constant.js +5 -0
- package/package/database/node_modules/lodash/fp/contains.js +1 -0
- package/package/database/node_modules/lodash/fp/convert.js +18 -0
- package/package/database/node_modules/lodash/fp/countBy.js +5 -0
- package/package/database/node_modules/lodash/fp/create.js +5 -0
- package/package/database/node_modules/lodash/fp/curry.js +5 -0
- package/package/database/node_modules/lodash/fp/curryN.js +5 -0
- package/package/database/node_modules/lodash/fp/curryRight.js +5 -0
- package/package/database/node_modules/lodash/fp/curryRightN.js +5 -0
- package/package/database/node_modules/lodash/fp/date.js +2 -0
- package/package/database/node_modules/lodash/fp/debounce.js +5 -0
- package/package/database/node_modules/lodash/fp/deburr.js +5 -0
- package/package/database/node_modules/lodash/fp/defaultTo.js +5 -0
- package/package/database/node_modules/lodash/fp/defaults.js +5 -0
- package/package/database/node_modules/lodash/fp/defaultsAll.js +5 -0
- package/package/database/node_modules/lodash/fp/defaultsDeep.js +5 -0
- package/package/database/node_modules/lodash/fp/defaultsDeepAll.js +5 -0
- package/package/database/node_modules/lodash/fp/defer.js +5 -0
- package/package/database/node_modules/lodash/fp/delay.js +5 -0
- package/package/database/node_modules/lodash/fp/difference.js +5 -0
- package/package/database/node_modules/lodash/fp/differenceBy.js +5 -0
- package/package/database/node_modules/lodash/fp/differenceWith.js +5 -0
- package/package/database/node_modules/lodash/fp/dissoc.js +1 -0
- package/package/database/node_modules/lodash/fp/dissocPath.js +1 -0
- package/package/database/node_modules/lodash/fp/divide.js +5 -0
- package/package/database/node_modules/lodash/fp/drop.js +5 -0
- package/package/database/node_modules/lodash/fp/dropLast.js +1 -0
- package/package/database/node_modules/lodash/fp/dropLastWhile.js +1 -0
- package/package/database/node_modules/lodash/fp/dropRight.js +5 -0
- package/package/database/node_modules/lodash/fp/dropRightWhile.js +5 -0
- package/package/database/node_modules/lodash/fp/dropWhile.js +5 -0
- package/package/database/node_modules/lodash/fp/each.js +1 -0
- package/package/database/node_modules/lodash/fp/eachRight.js +1 -0
- package/package/database/node_modules/lodash/fp/endsWith.js +5 -0
- package/package/database/node_modules/lodash/fp/entries.js +1 -0
- package/package/database/node_modules/lodash/fp/entriesIn.js +1 -0
- package/package/database/node_modules/lodash/fp/eq.js +5 -0
- package/package/database/node_modules/lodash/fp/equals.js +1 -0
- package/package/database/node_modules/lodash/fp/escape.js +5 -0
- package/package/database/node_modules/lodash/fp/escapeRegExp.js +5 -0
- package/package/database/node_modules/lodash/fp/every.js +5 -0
- package/package/database/node_modules/lodash/fp/extend.js +1 -0
- package/package/database/node_modules/lodash/fp/extendAll.js +1 -0
- package/package/database/node_modules/lodash/fp/extendAllWith.js +1 -0
- package/package/database/node_modules/lodash/fp/extendWith.js +1 -0
- package/package/database/node_modules/lodash/fp/fill.js +5 -0
- package/package/database/node_modules/lodash/fp/filter.js +5 -0
- package/package/database/node_modules/lodash/fp/find.js +5 -0
- package/package/database/node_modules/lodash/fp/findFrom.js +5 -0
- package/package/database/node_modules/lodash/fp/findIndex.js +5 -0
- package/package/database/node_modules/lodash/fp/findIndexFrom.js +5 -0
- package/package/database/node_modules/lodash/fp/findKey.js +5 -0
- package/package/database/node_modules/lodash/fp/findLast.js +5 -0
- package/package/database/node_modules/lodash/fp.js +2 -0
- package/package/database/node_modules/lodash/fromPairs.js +28 -0
- package/package/database/node_modules/lodash/function.js +25 -0
- package/package/database/node_modules/lodash/functions.js +31 -0
- package/package/database/node_modules/lodash/functionsIn.js +31 -0
- package/package/database/node_modules/lodash/get.js +33 -0
- package/package/database/node_modules/node-fetch/CHANGELOG.md +266 -0
- package/package/database/node_modules/node-fetch/LICENSE.md +22 -0
- package/package/database/node_modules/node-fetch/README.md +583 -0
- package/package/database/node_modules/node-fetch/browser.js +23 -0
- package/package/database/node_modules/node-fetch/lib/index.es.js +1633 -0
- package/package/database/node_modules/node-fetch/lib/index.js +1642 -0
- package/package/database/node_modules/node-fetch/lib/index.mjs +1631 -0
- package/package/database/node_modules/node-fetch/package.json +70 -0
- package/package/database/node_modules/sqlite3/CHANGELOG.md +313 -0
- package/package/database/node_modules/sqlite3/CONTRIBUTING.md +57 -0
- package/package/database/node_modules/sqlite3/LICENSE +25 -0
- package/package/database/node_modules/sqlite3/README.md +259 -0
- package/package/database/node_modules/sqlite3/binding.gyp +66 -0
- package/package/database/node_modules/sqlite3/deps/common-sqlite.gypi +60 -0
- package/package/database/node_modules/sqlite3/deps/extract.js +10 -0
- package/package/database/node_modules/sqlite3/deps/sqlite-autoconf-3380200.tar.gz +0 -0
- package/package/database/node_modules/sqlite3/deps/sqlite3.gyp +121 -0
- package/package/database/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node +0 -0
- package/package/database/node_modules/sqlite3/lib/index.js +1 -0
- package/package/database/node_modules/sqlite3/lib/sqlite3-binding.js +5 -0
- package/package/database/node_modules/sqlite3/lib/sqlite3.js +205 -0
- package/package/database/node_modules/sqlite3/lib/trace.js +38 -0
- package/package/database/node_modules/sqlite3/package.json +82 -0
- package/package/database/node_modules/sqlite3/sqlite3.js +1 -0
- package/package/database/node_modules/sqlite3/src/async.h +82 -0
- package/package/database/node_modules/sqlite3/src/backup.cc +420 -0
- package/package/database/node_modules/sqlite3/src/backup.h +221 -0
- package/package/database/node_modules/sqlite3/src/database.cc +738 -0
- package/package/database/node_modules/sqlite3/src/database.h +206 -0
- package/package/database/node_modules/sqlite3/src/gcc-preinclude.h +6 -0
- package/package/database/node_modules/sqlite3/src/macros.h +212 -0
- package/package/database/node_modules/sqlite3/src/node_sqlite3.cc +115 -0
- package/package/database/node_modules/sqlite3/src/statement.cc +947 -0
- package/package/database/node_modules/sqlite3/src/statement.h +249 -0
- package/package/database/node_modules/sqlite3/src/threading.h +48 -0
- package/package/database/package.json +31 -0
- package/package/database/readme.md +8 -0
- package/package/database/test.js +3 -0
- package/package/horizon-sp/README.md +11 -0
- package/package/horizon-sp/index.js +41 -0
- package/package/horizon-sp/logger.js +16 -0
- package/package/horizon-sp/node_modules/.package-lock.json +140 -0
- package/package/horizon-sp/node_modules/asynckit/LICENSE +21 -0
- package/package/horizon-sp/node_modules/asynckit/README.md +233 -0
- package/package/horizon-sp/node_modules/asynckit/bench.js +76 -0
- package/package/horizon-sp/node_modules/asynckit/index.js +6 -0
- package/package/horizon-sp/node_modules/asynckit/lib/abort.js +29 -0
- package/package/horizon-sp/node_modules/asynckit/lib/async.js +34 -0
- package/package/horizon-sp/node_modules/asynckit/lib/defer.js +26 -0
- package/package/horizon-sp/node_modules/asynckit/lib/iterate.js +75 -0
- package/package/horizon-sp/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/package/horizon-sp/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/package/horizon-sp/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/package/horizon-sp/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/package/horizon-sp/node_modules/asynckit/lib/state.js +37 -0
- package/package/horizon-sp/node_modules/asynckit/lib/streamify.js +141 -0
- package/package/horizon-sp/node_modules/asynckit/lib/terminator.js +29 -0
- package/package/horizon-sp/node_modules/asynckit/package.json +63 -0
- package/package/horizon-sp/node_modules/asynckit/parallel.js +43 -0
- package/package/horizon-sp/node_modules/asynckit/serial.js +17 -0
- package/package/horizon-sp/node_modules/asynckit/serialOrdered.js +75 -0
- package/package/horizon-sp/node_modules/asynckit/stream.js +21 -0
- package/package/horizon-sp/node_modules/axios/CHANGELOG.md +410 -0
- package/package/horizon-sp/node_modules/axios/LICENSE +7 -0
- package/package/horizon-sp/node_modules/axios/MIGRATION_GUIDE.md +3 -0
- package/package/horizon-sp/node_modules/axios/README.md +1310 -0
- package/package/horizon-sp/node_modules/axios/SECURITY.md +6 -0
- package/package/horizon-sp/node_modules/axios/index.d.cts +524 -0
- package/package/horizon-sp/node_modules/axios/index.d.ts +539 -0
- package/package/horizon-sp/node_modules/axios/index.js +41 -0
- package/package/horizon-sp/node_modules/axios/lib/adapters/README.md +37 -0
- package/package/horizon-sp/node_modules/axios/lib/adapters/adapters.js +59 -0
- package/package/horizon-sp/node_modules/axios/lib/adapters/http.js +608 -0
- package/package/horizon-sp/node_modules/axios/lib/adapters/xhr.js +249 -0
- package/package/horizon-sp/node_modules/axios/lib/axios.js +86 -0
- package/package/horizon-sp/node_modules/axios/lib/cancel/CancelToken.js +121 -0
- package/package/horizon-sp/node_modules/axios/lib/cancel/CanceledError.js +25 -0
- package/package/horizon-sp/node_modules/axios/lib/cancel/isCancel.js +5 -0
- package/package/horizon-sp/node_modules/axios/lib/core/Axios.js +197 -0
- package/package/horizon-sp/node_modules/axios/lib/core/AxiosError.js +100 -0
- package/package/horizon-sp/node_modules/axios/lib/core/AxiosHeaders.js +274 -0
- package/package/horizon-sp/node_modules/axios/lib/core/InterceptorManager.js +71 -0
- package/package/horizon-sp/node_modules/axios/lib/core/README.md +8 -0
- package/package/horizon-sp/node_modules/axios/lib/core/buildFullPath.js +21 -0
- package/package/horizon-sp/node_modules/axios/lib/core/dispatchRequest.js +81 -0
- package/package/horizon-sp/node_modules/axios/lib/core/mergeConfig.js +105 -0
- package/package/horizon-sp/node_modules/axios/lib/core/settle.js +27 -0
- package/package/horizon-sp/node_modules/axios/lib/core/transformData.js +28 -0
- package/package/horizon-sp/node_modules/axios/lib/defaults/index.js +166 -0
- package/package/horizon-sp/node_modules/axios/lib/defaults/transitional.js +7 -0
- package/package/horizon-sp/node_modules/axios/lib/env/README.md +3 -0
- package/package/horizon-sp/node_modules/axios/lib/env/classes/FormData.js +2 -0
- package/package/horizon-sp/node_modules/axios/lib/env/data.js +1 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/AxiosTransformStream.js +191 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +58 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/HttpStatusCode.js +71 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/README.md +7 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/bind.js +7 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/buildURL.js +63 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/combineURLs.js +15 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/cookies.js +52 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/deprecatedMethod.js +26 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/formDataToJSON.js +92 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/fromDataURI.js +53 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/isAbsoluteURL.js +15 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/isURLSameOrigin.js +67 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/null.js +2 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/parseHeaders.js +55 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/speedometer.js +55 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/spread.js +28 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/throttle.js +33 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/toFormData.js +229 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/toURLEncodedForm.js +18 -0
- package/package/horizon-sp/node_modules/axios/lib/helpers/validator.js +91 -0
- package/package/horizon-sp/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
- package/package/horizon-sp/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
- package/package/horizon-sp/node_modules/axios/lib/platform/browser/index.js +63 -0
- package/package/horizon-sp/node_modules/axios/lib/platform/index.js +3 -0
- package/package/horizon-sp/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
- package/package/horizon-sp/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
- package/package/horizon-sp/node_modules/axios/lib/platform/node/index.js +12 -0
- package/package/horizon-sp/node_modules/axios/lib/utils.js +677 -0
- package/package/horizon-sp/node_modules/axios/package.json +197 -0
- package/package/horizon-sp/node_modules/child_process/README.md +9 -0
- package/package/horizon-sp/node_modules/child_process/package.json +20 -0
- package/package/horizon-sp/node_modules/combined-stream/License +19 -0
- package/package/horizon-sp/node_modules/combined-stream/Readme.md +138 -0
- package/package/horizon-sp/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/package/horizon-sp/node_modules/combined-stream/package.json +25 -0
- package/package/horizon-sp/node_modules/delayed-stream/License +19 -0
- package/package/horizon-sp/node_modules/delayed-stream/Makefile +7 -0
- package/package/horizon-sp/node_modules/delayed-stream/Readme.md +141 -0
- package/package/horizon-sp/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/package/horizon-sp/node_modules/delayed-stream/package.json +27 -0
- package/package/horizon-sp/node_modules/follow-redirects/LICENSE +18 -0
- package/package/horizon-sp/node_modules/follow-redirects/README.md +155 -0
- package/package/horizon-sp/node_modules/follow-redirects/debug.js +15 -0
- package/package/horizon-sp/node_modules/follow-redirects/http.js +1 -0
- package/package/horizon-sp/node_modules/follow-redirects/https.js +1 -0
- package/package/horizon-sp/node_modules/follow-redirects/index.js +621 -0
- package/package/horizon-sp/node_modules/follow-redirects/package.json +59 -0
- package/package/horizon-sp/node_modules/form-data/License +19 -0
- package/package/horizon-sp/node_modules/form-data/README.md.bak +358 -0
- package/package/horizon-sp/node_modules/form-data/Readme.md +358 -0
- package/package/horizon-sp/node_modules/form-data/index.d.ts +62 -0
- package/package/horizon-sp/node_modules/form-data/lib/browser.js +2 -0
- package/package/horizon-sp/node_modules/form-data/lib/form_data.js +501 -0
- package/package/horizon-sp/node_modules/form-data/lib/populate.js +10 -0
- package/package/horizon-sp/node_modules/form-data/package.json +68 -0
- package/package/horizon-sp/node_modules/fs-extra/LICENSE +15 -0
- package/package/horizon-sp/node_modules/fs-extra/README.md +290 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/copy/copy-sync.js +161 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/copy/copy.js +238 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/copy/index.js +7 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/empty/index.js +39 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/ensure/file.js +69 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/ensure/index.js +23 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/ensure/link.js +64 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/ensure/symlink-paths.js +99 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/ensure/symlink-type.js +31 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/ensure/symlink.js +82 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/esm.mjs +68 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/fs/index.js +140 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/index.js +16 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/json/index.js +16 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/json/output-json.js +12 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/move/index.js +7 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/move/move-sync.js +54 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/move/move.js +75 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/output-file/index.js +40 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/path-exists/index.js +12 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/remove/index.js +17 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/util/stat.js +154 -0
- package/package/horizon-sp/node_modules/fs-extra/lib/util/utimes.js +26 -0
- package/package/horizon-sp/node_modules/fs-extra/package.json +71 -0
- package/package/horizon-sp/node_modules/graceful-fs/LICENSE +15 -0
- package/package/horizon-sp/node_modules/graceful-fs/README.md +143 -0
- package/package/horizon-sp/node_modules/graceful-fs/clone.js +23 -0
- package/package/horizon-sp/node_modules/graceful-fs/graceful-fs.js +448 -0
- package/package/horizon-sp/node_modules/graceful-fs/legacy-streams.js +118 -0
- package/package/horizon-sp/node_modules/graceful-fs/package.json +50 -0
- package/package/horizon-sp/node_modules/graceful-fs/polyfills.js +355 -0
- package/package/horizon-sp/node_modules/jsonfile/CHANGELOG.md +171 -0
- package/package/horizon-sp/node_modules/jsonfile/LICENSE +15 -0
- package/package/horizon-sp/node_modules/jsonfile/README.md +230 -0
- package/package/horizon-sp/node_modules/jsonfile/index.js +88 -0
- package/package/horizon-sp/node_modules/jsonfile/package.json +40 -0
- package/package/horizon-sp/node_modules/jsonfile/utils.js +14 -0
- package/package/horizon-sp/node_modules/mime-db/HISTORY.md +507 -0
- package/package/horizon-sp/node_modules/mime-db/LICENSE +23 -0
- package/package/horizon-sp/node_modules/mime-db/README.md +100 -0
- package/package/horizon-sp/node_modules/mime-db/db.json +8519 -0
- package/package/horizon-sp/node_modules/mime-db/index.js +12 -0
- package/package/horizon-sp/node_modules/mime-db/package.json +60 -0
- package/package/horizon-sp/node_modules/mime-types/HISTORY.md +397 -0
- package/package/horizon-sp/node_modules/mime-types/LICENSE +23 -0
- package/package/horizon-sp/node_modules/mime-types/README.md +113 -0
- package/package/horizon-sp/node_modules/mime-types/index.js +188 -0
- package/package/horizon-sp/node_modules/mime-types/package.json +44 -0
- package/package/horizon-sp/node_modules/proxy-from-env/LICENSE +20 -0
- package/package/horizon-sp/node_modules/proxy-from-env/README.md +131 -0
- package/package/horizon-sp/node_modules/proxy-from-env/index.js +108 -0
- package/package/horizon-sp/node_modules/proxy-from-env/package.json +34 -0
- package/package/horizon-sp/node_modules/proxy-from-env/test.js +483 -0
- package/package/horizon-sp/node_modules/universalify/LICENSE +20 -0
- package/package/horizon-sp/node_modules/universalify/README.md +76 -0
- package/package/horizon-sp/node_modules/universalify/index.js +24 -0
- package/package/horizon-sp/node_modules/universalify/package.json +34 -0
- package/package/horizon-sp/package-lock.json +150 -0
- package/package/horizon-sp/package.json +20 -0
- package/package.json +134 -3
- package/src/ReportV1.js +55 -0
- package/src/addExternalModule.js +16 -0
- package/src/addUserToGroup.js +78 -0
- package/src/changeAdminStatus.js +79 -0
- package/src/changeArchivedStatus.js +41 -0
- package/src/changeAvt.js +86 -0
- package/src/changeBio.js +65 -0
- package/src/changeBlockedStatus.js +36 -0
- package/src/changeGroupImage.js +106 -0
- package/src/changeNickname.js +45 -0
- package/src/changeThreadColor.js +62 -0
- package/src/changeThreadEmoji.js +42 -0
- package/src/createNewGroup.js +70 -0
- package/src/createPoll.js +60 -0
- package/src/data/getThreadInfo.json +31985 -0
- package/src/deleteMessage.js +45 -0
- package/src/deleteThread.js +43 -0
- package/src/forwardAttachment.js +48 -0
- package/src/getAccessToken.js +33 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +27 -0
- package/src/getFriendsList.js +73 -0
- package/src/getMessage.js +80 -0
- package/src/getThreadHistory.js +537 -0
- package/src/getThreadHistoryDeprecated.js +71 -0
- package/src/getThreadInfo.js +193 -0
- package/src/getThreadInfoDeprecated.js +56 -0
- package/src/getThreadList.js +213 -0
- package/src/getThreadListDeprecated.js +46 -0
- package/src/getThreadMain.js +219 -0
- package/src/getThreadPictures.js +59 -0
- package/src/getUserID.js +62 -0
- package/src/getUserInfo.js +66 -0
- package/src/getUserInfoMain.js +65 -0
- package/src/getUserInfoV2.js +36 -0
- package/src/getUserInfoV3.js +63 -0
- package/src/getUserInfoV4.js +55 -0
- package/src/getUserInfoV5.js +61 -0
- package/src/handleFriendRequest.js +46 -0
- package/src/handleMessageRequest.js +49 -0
- package/src/httpGet.js +49 -0
- package/src/httpPost.js +48 -0
- package/src/httpPostFormData.js +41 -0
- package/src/listenMqtt.js +629 -0
- package/src/logout.js +68 -0
- package/src/markAsDelivered.js +48 -0
- package/src/markAsRead.js +70 -0
- package/src/markAsReadAll.js +43 -0
- package/src/markAsSeen.js +51 -0
- package/src/muteThread.js +47 -0
- package/src/removeUserFromGroup.js +49 -0
- package/src/resolvePhotoUrl.js +37 -0
- package/src/searchForThread.js +43 -0
- package/src/sendMessage.js +321 -0
- package/src/sendTypingIndicator.js +80 -0
- package/src/setMessageReaction.js +109 -0
- package/src/setPostReaction.js +102 -0
- package/src/setTitle.js +74 -0
- package/src/threadColors.js +39 -0
- package/src/unfriend.js +43 -0
- package/src/unsendMessage.js +40 -0
- package/test/example-config.json +18 -0
- package/test/test-page.js +140 -0
- package/test/test.js +385 -0
- package/utils.js +1246 -0
@@ -0,0 +1,290 @@
|
|
1
|
+
Node.js: fs-extra
|
2
|
+
=================
|
3
|
+
|
4
|
+
`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`.
|
5
|
+
|
6
|
+
[![npm Package](https://img.shields.io/npm/v/fs-extra.svg)](https://www.npmjs.org/package/fs-extra)
|
7
|
+
[![License](https://img.shields.io/npm/l/fs-extra.svg)](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE)
|
8
|
+
[![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)
|
9
|
+
[![downloads per month](http://img.shields.io/npm/dm/fs-extra.svg)](https://www.npmjs.org/package/fs-extra)
|
10
|
+
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
|
11
|
+
|
12
|
+
Why?
|
13
|
+
----
|
14
|
+
|
15
|
+
I got tired of including `mkdirp`, `rimraf`, and `ncp` in most of my projects.
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Installation
|
21
|
+
------------
|
22
|
+
|
23
|
+
npm install fs-extra
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
Usage
|
28
|
+
-----
|
29
|
+
|
30
|
+
### CommonJS
|
31
|
+
|
32
|
+
`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.
|
33
|
+
|
34
|
+
You don't ever need to include the original `fs` module again:
|
35
|
+
|
36
|
+
```js
|
37
|
+
const fs = require('fs') // this is no longer necessary
|
38
|
+
```
|
39
|
+
|
40
|
+
you can now do this:
|
41
|
+
|
42
|
+
```js
|
43
|
+
const fs = require('fs-extra')
|
44
|
+
```
|
45
|
+
|
46
|
+
or if you prefer to make it clear that you're using `fs-extra` and not `fs`, you may want
|
47
|
+
to name your `fs` variable `fse` like so:
|
48
|
+
|
49
|
+
```js
|
50
|
+
const fse = require('fs-extra')
|
51
|
+
```
|
52
|
+
|
53
|
+
you can also keep both, but it's redundant:
|
54
|
+
|
55
|
+
```js
|
56
|
+
const fs = require('fs')
|
57
|
+
const fse = require('fs-extra')
|
58
|
+
```
|
59
|
+
|
60
|
+
### ESM
|
61
|
+
|
62
|
+
There is also an `fs-extra/esm` import, that supports both default and named exports. However, note that `fs` methods are not included in `fs-extra/esm`; you still need to import `fs` and/or `fs/promises` seperately:
|
63
|
+
|
64
|
+
```js
|
65
|
+
import { readFileSync } from 'fs'
|
66
|
+
import { readFile } from 'fs/promises'
|
67
|
+
import { outputFile, outputFileSync } from 'fs-extra/esm'
|
68
|
+
```
|
69
|
+
|
70
|
+
Default exports are supported:
|
71
|
+
|
72
|
+
```js
|
73
|
+
import fs from 'fs'
|
74
|
+
import fse from 'fs-extra/esm'
|
75
|
+
// fse.readFileSync is not a function; must use fs.readFileSync
|
76
|
+
```
|
77
|
+
|
78
|
+
but you probably want to just use regular `fs-extra` instead of `fs-extra/esm` for default exports:
|
79
|
+
|
80
|
+
```js
|
81
|
+
import fs from 'fs-extra'
|
82
|
+
// both fs and fs-extra methods are defined
|
83
|
+
```
|
84
|
+
|
85
|
+
Sync vs Async vs Async/Await
|
86
|
+
-------------
|
87
|
+
Most methods are async by default. All async methods will return a promise if the callback isn't passed.
|
88
|
+
|
89
|
+
Sync methods on the other hand will throw if an error occurs.
|
90
|
+
|
91
|
+
Also Async/Await will throw an error if one occurs.
|
92
|
+
|
93
|
+
Example:
|
94
|
+
|
95
|
+
```js
|
96
|
+
const fs = require('fs-extra')
|
97
|
+
|
98
|
+
// Async with promises:
|
99
|
+
fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
100
|
+
.then(() => console.log('success!'))
|
101
|
+
.catch(err => console.error(err))
|
102
|
+
|
103
|
+
// Async with callbacks:
|
104
|
+
fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
|
105
|
+
if (err) return console.error(err)
|
106
|
+
console.log('success!')
|
107
|
+
})
|
108
|
+
|
109
|
+
// Sync:
|
110
|
+
try {
|
111
|
+
fs.copySync('/tmp/myfile', '/tmp/mynewfile')
|
112
|
+
console.log('success!')
|
113
|
+
} catch (err) {
|
114
|
+
console.error(err)
|
115
|
+
}
|
116
|
+
|
117
|
+
// Async/Await:
|
118
|
+
async function copyFiles () {
|
119
|
+
try {
|
120
|
+
await fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
121
|
+
console.log('success!')
|
122
|
+
} catch (err) {
|
123
|
+
console.error(err)
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
copyFiles()
|
128
|
+
```
|
129
|
+
|
130
|
+
|
131
|
+
Methods
|
132
|
+
-------
|
133
|
+
|
134
|
+
### Async
|
135
|
+
|
136
|
+
- [copy](docs/copy.md)
|
137
|
+
- [emptyDir](docs/emptyDir.md)
|
138
|
+
- [ensureFile](docs/ensureFile.md)
|
139
|
+
- [ensureDir](docs/ensureDir.md)
|
140
|
+
- [ensureLink](docs/ensureLink.md)
|
141
|
+
- [ensureSymlink](docs/ensureSymlink.md)
|
142
|
+
- [mkdirp](docs/ensureDir.md)
|
143
|
+
- [mkdirs](docs/ensureDir.md)
|
144
|
+
- [move](docs/move.md)
|
145
|
+
- [outputFile](docs/outputFile.md)
|
146
|
+
- [outputJson](docs/outputJson.md)
|
147
|
+
- [pathExists](docs/pathExists.md)
|
148
|
+
- [readJson](docs/readJson.md)
|
149
|
+
- [remove](docs/remove.md)
|
150
|
+
- [writeJson](docs/writeJson.md)
|
151
|
+
|
152
|
+
### Sync
|
153
|
+
|
154
|
+
- [copySync](docs/copy-sync.md)
|
155
|
+
- [emptyDirSync](docs/emptyDir-sync.md)
|
156
|
+
- [ensureFileSync](docs/ensureFile-sync.md)
|
157
|
+
- [ensureDirSync](docs/ensureDir-sync.md)
|
158
|
+
- [ensureLinkSync](docs/ensureLink-sync.md)
|
159
|
+
- [ensureSymlinkSync](docs/ensureSymlink-sync.md)
|
160
|
+
- [mkdirpSync](docs/ensureDir-sync.md)
|
161
|
+
- [mkdirsSync](docs/ensureDir-sync.md)
|
162
|
+
- [moveSync](docs/move-sync.md)
|
163
|
+
- [outputFileSync](docs/outputFile-sync.md)
|
164
|
+
- [outputJsonSync](docs/outputJson-sync.md)
|
165
|
+
- [pathExistsSync](docs/pathExists-sync.md)
|
166
|
+
- [readJsonSync](docs/readJson-sync.md)
|
167
|
+
- [removeSync](docs/remove-sync.md)
|
168
|
+
- [writeJsonSync](docs/writeJson-sync.md)
|
169
|
+
|
170
|
+
|
171
|
+
**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)
|
172
|
+
|
173
|
+
### What happened to `walk()` and `walkSync()`?
|
174
|
+
|
175
|
+
They 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).
|
176
|
+
|
177
|
+
|
178
|
+
Third Party
|
179
|
+
-----------
|
180
|
+
|
181
|
+
### CLI
|
182
|
+
|
183
|
+
[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.
|
184
|
+
|
185
|
+
### TypeScript
|
186
|
+
|
187
|
+
If you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra
|
188
|
+
|
189
|
+
|
190
|
+
### File / Directory Watching
|
191
|
+
|
192
|
+
If you want to watch for changes to files or directories, then you should use [chokidar](https://github.com/paulmillr/chokidar).
|
193
|
+
|
194
|
+
### Obtain Filesystem (Devices, Partitions) Information
|
195
|
+
|
196
|
+
[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.
|
197
|
+
|
198
|
+
### Misc.
|
199
|
+
|
200
|
+
- [fs-extra-debug](https://github.com/jdxcode/fs-extra-debug) - Send your fs-extra calls to [debug](https://npmjs.org/package/debug).
|
201
|
+
- [mfs](https://github.com/cadorn/mfs) - Monitor your fs-extra calls.
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
Hacking on fs-extra
|
206
|
+
-------------------
|
207
|
+
|
208
|
+
Wanna 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
|
209
|
+
uses [JavaScript Standard Style](https://github.com/feross/standard) - if the name or style choices bother you,
|
210
|
+
you're gonna have to get over it :) If `standard` is good enough for `npm`, it's good enough for `fs-extra`.
|
211
|
+
|
212
|
+
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
|
213
|
+
|
214
|
+
What's needed?
|
215
|
+
- First, take a look at existing issues. Those are probably going to be where the priority lies.
|
216
|
+
- More tests for edge cases. Specifically on different platforms. There can never be enough tests.
|
217
|
+
- Improve test coverage.
|
218
|
+
|
219
|
+
Note: If you make any big changes, **you should definitely file an issue for discussion first.**
|
220
|
+
|
221
|
+
### Running the Test Suite
|
222
|
+
|
223
|
+
fs-extra contains hundreds of tests.
|
224
|
+
|
225
|
+
- `npm run lint`: runs the linter ([standard](http://standardjs.com/))
|
226
|
+
- `npm run unit`: runs the unit tests
|
227
|
+
- `npm run unit-esm`: runs tests for `fs-extra/esm` exports
|
228
|
+
- `npm test`: runs the linter and all tests
|
229
|
+
|
230
|
+
|
231
|
+
### Windows
|
232
|
+
|
233
|
+
If you run the tests on the Windows and receive a lot of symbolic link `EPERM` permission errors, it's
|
234
|
+
because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's
|
235
|
+
account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7
|
236
|
+
However, I didn't have much luck doing this.
|
237
|
+
|
238
|
+
Since 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.
|
239
|
+
I open the `Node.js command prompt` and run as `Administrator`. I then map the network drive running the following command:
|
240
|
+
|
241
|
+
net use z: "\\vmware-host\Shared Folders"
|
242
|
+
|
243
|
+
I can then navigate to my `fs-extra` directory and run the tests.
|
244
|
+
|
245
|
+
|
246
|
+
Naming
|
247
|
+
------
|
248
|
+
|
249
|
+
I 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:
|
250
|
+
|
251
|
+
* https://github.com/jprichardson/node-fs-extra/issues/2
|
252
|
+
* https://github.com/flatiron/utile/issues/11
|
253
|
+
* https://github.com/ryanmcgrath/wrench-js/issues/29
|
254
|
+
* https://github.com/substack/node-mkdirp/issues/17
|
255
|
+
|
256
|
+
First, 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.
|
257
|
+
|
258
|
+
For 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.
|
259
|
+
|
260
|
+
We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: `cp`, `cp -r`, `mkdir -p`, and `rm -rf`?
|
261
|
+
|
262
|
+
My 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.
|
263
|
+
|
264
|
+
So, 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)`.
|
265
|
+
|
266
|
+
|
267
|
+
Credit
|
268
|
+
------
|
269
|
+
|
270
|
+
`fs-extra` wouldn't be possible without using the modules from the following authors:
|
271
|
+
|
272
|
+
- [Isaac Shlueter](https://github.com/isaacs)
|
273
|
+
- [Charlie McConnel](https://github.com/avianflu)
|
274
|
+
- [James Halliday](https://github.com/substack)
|
275
|
+
- [Andrew Kelley](https://github.com/andrewrk)
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
License
|
281
|
+
-------
|
282
|
+
|
283
|
+
Licensed under MIT
|
284
|
+
|
285
|
+
Copyright (c) 2011-2017 [JP Richardson](https://github.com/jprichardson)
|
286
|
+
|
287
|
+
[1]: http://nodejs.org/docs/latest/api/fs.html
|
288
|
+
|
289
|
+
|
290
|
+
[jsonfile]: https://github.com/jprichardson/node-jsonfile
|
@@ -0,0 +1,161 @@
|
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
const fs = require('graceful-fs')
|
4
|
+
const path = require('path')
|
5
|
+
const mkdirsSync = require('../mkdirs').mkdirsSync
|
6
|
+
const utimesMillisSync = require('../util/utimes').utimesMillisSync
|
7
|
+
const stat = require('../util/stat')
|
8
|
+
|
9
|
+
function copySync (src, dest, opts) {
|
10
|
+
if (typeof opts === 'function') {
|
11
|
+
opts = { filter: opts }
|
12
|
+
}
|
13
|
+
|
14
|
+
opts = opts || {}
|
15
|
+
opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
|
16
|
+
opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
|
17
|
+
|
18
|
+
// Warn about using preserveTimestamps on 32-bit node
|
19
|
+
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
20
|
+
process.emitWarning(
|
21
|
+
'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
|
22
|
+
'\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
|
23
|
+
'Warning', 'fs-extra-WARN0002'
|
24
|
+
)
|
25
|
+
}
|
26
|
+
|
27
|
+
const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
|
28
|
+
stat.checkParentPathsSync(src, srcStat, dest, 'copy')
|
29
|
+
if (opts.filter && !opts.filter(src, dest)) return
|
30
|
+
const destParent = path.dirname(dest)
|
31
|
+
if (!fs.existsSync(destParent)) mkdirsSync(destParent)
|
32
|
+
return getStats(destStat, src, dest, opts)
|
33
|
+
}
|
34
|
+
|
35
|
+
function getStats (destStat, src, dest, opts) {
|
36
|
+
const statSync = opts.dereference ? fs.statSync : fs.lstatSync
|
37
|
+
const srcStat = statSync(src)
|
38
|
+
|
39
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
|
40
|
+
else if (srcStat.isFile() ||
|
41
|
+
srcStat.isCharacterDevice() ||
|
42
|
+
srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
|
43
|
+
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
|
44
|
+
else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
|
45
|
+
else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
|
46
|
+
throw new Error(`Unknown file: ${src}`)
|
47
|
+
}
|
48
|
+
|
49
|
+
function onFile (srcStat, destStat, src, dest, opts) {
|
50
|
+
if (!destStat) return copyFile(srcStat, src, dest, opts)
|
51
|
+
return mayCopyFile(srcStat, src, dest, opts)
|
52
|
+
}
|
53
|
+
|
54
|
+
function mayCopyFile (srcStat, src, dest, opts) {
|
55
|
+
if (opts.overwrite) {
|
56
|
+
fs.unlinkSync(dest)
|
57
|
+
return copyFile(srcStat, src, dest, opts)
|
58
|
+
} else if (opts.errorOnExist) {
|
59
|
+
throw new Error(`'${dest}' already exists`)
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
function copyFile (srcStat, src, dest, opts) {
|
64
|
+
fs.copyFileSync(src, dest)
|
65
|
+
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)
|
66
|
+
return setDestMode(dest, srcStat.mode)
|
67
|
+
}
|
68
|
+
|
69
|
+
function handleTimestamps (srcMode, src, dest) {
|
70
|
+
// Make sure the file is writable before setting the timestamp
|
71
|
+
// otherwise open fails with EPERM when invoked with 'r+'
|
72
|
+
// (through utimes call)
|
73
|
+
if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)
|
74
|
+
return setDestTimestamps(src, dest)
|
75
|
+
}
|
76
|
+
|
77
|
+
function fileIsNotWritable (srcMode) {
|
78
|
+
return (srcMode & 0o200) === 0
|
79
|
+
}
|
80
|
+
|
81
|
+
function makeFileWritable (dest, srcMode) {
|
82
|
+
return setDestMode(dest, srcMode | 0o200)
|
83
|
+
}
|
84
|
+
|
85
|
+
function setDestMode (dest, srcMode) {
|
86
|
+
return fs.chmodSync(dest, srcMode)
|
87
|
+
}
|
88
|
+
|
89
|
+
function setDestTimestamps (src, dest) {
|
90
|
+
// The initial srcStat.atime cannot be trusted
|
91
|
+
// because it is modified by the read(2) system call
|
92
|
+
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
93
|
+
const updatedSrcStat = fs.statSync(src)
|
94
|
+
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
|
95
|
+
}
|
96
|
+
|
97
|
+
function onDir (srcStat, destStat, src, dest, opts) {
|
98
|
+
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
|
99
|
+
return copyDir(src, dest, opts)
|
100
|
+
}
|
101
|
+
|
102
|
+
function mkDirAndCopy (srcMode, src, dest, opts) {
|
103
|
+
fs.mkdirSync(dest)
|
104
|
+
copyDir(src, dest, opts)
|
105
|
+
return setDestMode(dest, srcMode)
|
106
|
+
}
|
107
|
+
|
108
|
+
function copyDir (src, dest, opts) {
|
109
|
+
fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts))
|
110
|
+
}
|
111
|
+
|
112
|
+
function copyDirItem (item, src, dest, opts) {
|
113
|
+
const srcItem = path.join(src, item)
|
114
|
+
const destItem = path.join(dest, item)
|
115
|
+
if (opts.filter && !opts.filter(srcItem, destItem)) return
|
116
|
+
const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
|
117
|
+
return getStats(destStat, srcItem, destItem, opts)
|
118
|
+
}
|
119
|
+
|
120
|
+
function onLink (destStat, src, dest, opts) {
|
121
|
+
let resolvedSrc = fs.readlinkSync(src)
|
122
|
+
if (opts.dereference) {
|
123
|
+
resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
|
124
|
+
}
|
125
|
+
|
126
|
+
if (!destStat) {
|
127
|
+
return fs.symlinkSync(resolvedSrc, dest)
|
128
|
+
} else {
|
129
|
+
let resolvedDest
|
130
|
+
try {
|
131
|
+
resolvedDest = fs.readlinkSync(dest)
|
132
|
+
} catch (err) {
|
133
|
+
// dest exists and is a regular file or directory,
|
134
|
+
// Windows may throw UNKNOWN error. If dest already exists,
|
135
|
+
// fs throws error anyway, so no need to guard against it here.
|
136
|
+
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest)
|
137
|
+
throw err
|
138
|
+
}
|
139
|
+
if (opts.dereference) {
|
140
|
+
resolvedDest = path.resolve(process.cwd(), resolvedDest)
|
141
|
+
}
|
142
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
143
|
+
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
|
144
|
+
}
|
145
|
+
|
146
|
+
// prevent copy if src is a subdir of dest since unlinking
|
147
|
+
// dest in this case would result in removing src contents
|
148
|
+
// and therefore a broken symlink would be created.
|
149
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
150
|
+
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
|
151
|
+
}
|
152
|
+
return copyLink(resolvedSrc, dest)
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
function copyLink (resolvedSrc, dest) {
|
157
|
+
fs.unlinkSync(dest)
|
158
|
+
return fs.symlinkSync(resolvedSrc, dest)
|
159
|
+
}
|
160
|
+
|
161
|
+
module.exports = copySync
|
@@ -0,0 +1,238 @@
|
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
const fs = require('graceful-fs')
|
4
|
+
const path = require('path')
|
5
|
+
const mkdirs = require('../mkdirs').mkdirs
|
6
|
+
const pathExists = require('../path-exists').pathExists
|
7
|
+
const utimesMillis = require('../util/utimes').utimesMillis
|
8
|
+
const stat = require('../util/stat')
|
9
|
+
|
10
|
+
function copy (src, dest, opts, cb) {
|
11
|
+
if (typeof opts === 'function' && !cb) {
|
12
|
+
cb = opts
|
13
|
+
opts = {}
|
14
|
+
} else if (typeof opts === 'function') {
|
15
|
+
opts = { filter: opts }
|
16
|
+
}
|
17
|
+
|
18
|
+
cb = cb || function () {}
|
19
|
+
opts = opts || {}
|
20
|
+
|
21
|
+
opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
|
22
|
+
opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
|
23
|
+
|
24
|
+
// Warn about using preserveTimestamps on 32-bit node
|
25
|
+
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
26
|
+
process.emitWarning(
|
27
|
+
'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
|
28
|
+
'\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
|
29
|
+
'Warning', 'fs-extra-WARN0001'
|
30
|
+
)
|
31
|
+
}
|
32
|
+
|
33
|
+
stat.checkPaths(src, dest, 'copy', opts, (err, stats) => {
|
34
|
+
if (err) return cb(err)
|
35
|
+
const { srcStat, destStat } = stats
|
36
|
+
stat.checkParentPaths(src, srcStat, dest, 'copy', err => {
|
37
|
+
if (err) return cb(err)
|
38
|
+
runFilter(src, dest, opts, (err, include) => {
|
39
|
+
if (err) return cb(err)
|
40
|
+
if (!include) return cb()
|
41
|
+
|
42
|
+
checkParentDir(destStat, src, dest, opts, cb)
|
43
|
+
})
|
44
|
+
})
|
45
|
+
})
|
46
|
+
}
|
47
|
+
|
48
|
+
function checkParentDir (destStat, src, dest, opts, cb) {
|
49
|
+
const destParent = path.dirname(dest)
|
50
|
+
pathExists(destParent, (err, dirExists) => {
|
51
|
+
if (err) return cb(err)
|
52
|
+
if (dirExists) return getStats(destStat, src, dest, opts, cb)
|
53
|
+
mkdirs(destParent, err => {
|
54
|
+
if (err) return cb(err)
|
55
|
+
return getStats(destStat, src, dest, opts, cb)
|
56
|
+
})
|
57
|
+
})
|
58
|
+
}
|
59
|
+
|
60
|
+
function runFilter (src, dest, opts, cb) {
|
61
|
+
if (!opts.filter) return cb(null, true)
|
62
|
+
Promise.resolve(opts.filter(src, dest))
|
63
|
+
.then(include => cb(null, include), error => cb(error))
|
64
|
+
}
|
65
|
+
|
66
|
+
function getStats (destStat, src, dest, opts, cb) {
|
67
|
+
const stat = opts.dereference ? fs.stat : fs.lstat
|
68
|
+
stat(src, (err, srcStat) => {
|
69
|
+
if (err) return cb(err)
|
70
|
+
|
71
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb)
|
72
|
+
else if (srcStat.isFile() ||
|
73
|
+
srcStat.isCharacterDevice() ||
|
74
|
+
srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb)
|
75
|
+
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb)
|
76
|
+
else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`))
|
77
|
+
else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`))
|
78
|
+
return cb(new Error(`Unknown file: ${src}`))
|
79
|
+
})
|
80
|
+
}
|
81
|
+
|
82
|
+
function onFile (srcStat, destStat, src, dest, opts, cb) {
|
83
|
+
if (!destStat) return copyFile(srcStat, src, dest, opts, cb)
|
84
|
+
return mayCopyFile(srcStat, src, dest, opts, cb)
|
85
|
+
}
|
86
|
+
|
87
|
+
function mayCopyFile (srcStat, src, dest, opts, cb) {
|
88
|
+
if (opts.overwrite) {
|
89
|
+
fs.unlink(dest, err => {
|
90
|
+
if (err) return cb(err)
|
91
|
+
return copyFile(srcStat, src, dest, opts, cb)
|
92
|
+
})
|
93
|
+
} else if (opts.errorOnExist) {
|
94
|
+
return cb(new Error(`'${dest}' already exists`))
|
95
|
+
} else return cb()
|
96
|
+
}
|
97
|
+
|
98
|
+
function copyFile (srcStat, src, dest, opts, cb) {
|
99
|
+
fs.copyFile(src, dest, err => {
|
100
|
+
if (err) return cb(err)
|
101
|
+
if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb)
|
102
|
+
return setDestMode(dest, srcStat.mode, cb)
|
103
|
+
})
|
104
|
+
}
|
105
|
+
|
106
|
+
function handleTimestampsAndMode (srcMode, src, dest, cb) {
|
107
|
+
// Make sure the file is writable before setting the timestamp
|
108
|
+
// otherwise open fails with EPERM when invoked with 'r+'
|
109
|
+
// (through utimes call)
|
110
|
+
if (fileIsNotWritable(srcMode)) {
|
111
|
+
return makeFileWritable(dest, srcMode, err => {
|
112
|
+
if (err) return cb(err)
|
113
|
+
return setDestTimestampsAndMode(srcMode, src, dest, cb)
|
114
|
+
})
|
115
|
+
}
|
116
|
+
return setDestTimestampsAndMode(srcMode, src, dest, cb)
|
117
|
+
}
|
118
|
+
|
119
|
+
function fileIsNotWritable (srcMode) {
|
120
|
+
return (srcMode & 0o200) === 0
|
121
|
+
}
|
122
|
+
|
123
|
+
function makeFileWritable (dest, srcMode, cb) {
|
124
|
+
return setDestMode(dest, srcMode | 0o200, cb)
|
125
|
+
}
|
126
|
+
|
127
|
+
function setDestTimestampsAndMode (srcMode, src, dest, cb) {
|
128
|
+
setDestTimestamps(src, dest, err => {
|
129
|
+
if (err) return cb(err)
|
130
|
+
return setDestMode(dest, srcMode, cb)
|
131
|
+
})
|
132
|
+
}
|
133
|
+
|
134
|
+
function setDestMode (dest, srcMode, cb) {
|
135
|
+
return fs.chmod(dest, srcMode, cb)
|
136
|
+
}
|
137
|
+
|
138
|
+
function setDestTimestamps (src, dest, cb) {
|
139
|
+
// The initial srcStat.atime cannot be trusted
|
140
|
+
// because it is modified by the read(2) system call
|
141
|
+
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
142
|
+
fs.stat(src, (err, updatedSrcStat) => {
|
143
|
+
if (err) return cb(err)
|
144
|
+
return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb)
|
145
|
+
})
|
146
|
+
}
|
147
|
+
|
148
|
+
function onDir (srcStat, destStat, src, dest, opts, cb) {
|
149
|
+
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb)
|
150
|
+
return copyDir(src, dest, opts, cb)
|
151
|
+
}
|
152
|
+
|
153
|
+
function mkDirAndCopy (srcMode, src, dest, opts, cb) {
|
154
|
+
fs.mkdir(dest, err => {
|
155
|
+
if (err) return cb(err)
|
156
|
+
copyDir(src, dest, opts, err => {
|
157
|
+
if (err) return cb(err)
|
158
|
+
return setDestMode(dest, srcMode, cb)
|
159
|
+
})
|
160
|
+
})
|
161
|
+
}
|
162
|
+
|
163
|
+
function copyDir (src, dest, opts, cb) {
|
164
|
+
fs.readdir(src, (err, items) => {
|
165
|
+
if (err) return cb(err)
|
166
|
+
return copyDirItems(items, src, dest, opts, cb)
|
167
|
+
})
|
168
|
+
}
|
169
|
+
|
170
|
+
function copyDirItems (items, src, dest, opts, cb) {
|
171
|
+
const item = items.pop()
|
172
|
+
if (!item) return cb()
|
173
|
+
return copyDirItem(items, item, src, dest, opts, cb)
|
174
|
+
}
|
175
|
+
|
176
|
+
function copyDirItem (items, item, src, dest, opts, cb) {
|
177
|
+
const srcItem = path.join(src, item)
|
178
|
+
const destItem = path.join(dest, item)
|
179
|
+
runFilter(srcItem, destItem, opts, (err, include) => {
|
180
|
+
if (err) return cb(err)
|
181
|
+
if (!include) return copyDirItems(items, src, dest, opts, cb)
|
182
|
+
|
183
|
+
stat.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => {
|
184
|
+
if (err) return cb(err)
|
185
|
+
const { destStat } = stats
|
186
|
+
getStats(destStat, srcItem, destItem, opts, err => {
|
187
|
+
if (err) return cb(err)
|
188
|
+
return copyDirItems(items, src, dest, opts, cb)
|
189
|
+
})
|
190
|
+
})
|
191
|
+
})
|
192
|
+
}
|
193
|
+
|
194
|
+
function onLink (destStat, src, dest, opts, cb) {
|
195
|
+
fs.readlink(src, (err, resolvedSrc) => {
|
196
|
+
if (err) return cb(err)
|
197
|
+
if (opts.dereference) {
|
198
|
+
resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
|
199
|
+
}
|
200
|
+
|
201
|
+
if (!destStat) {
|
202
|
+
return fs.symlink(resolvedSrc, dest, cb)
|
203
|
+
} else {
|
204
|
+
fs.readlink(dest, (err, resolvedDest) => {
|
205
|
+
if (err) {
|
206
|
+
// dest exists and is a regular file or directory,
|
207
|
+
// Windows may throw UNKNOWN error. If dest already exists,
|
208
|
+
// fs throws error anyway, so no need to guard against it here.
|
209
|
+
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb)
|
210
|
+
return cb(err)
|
211
|
+
}
|
212
|
+
if (opts.dereference) {
|
213
|
+
resolvedDest = path.resolve(process.cwd(), resolvedDest)
|
214
|
+
}
|
215
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
216
|
+
return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`))
|
217
|
+
}
|
218
|
+
|
219
|
+
// do not copy if src is a subdir of dest since unlinking
|
220
|
+
// dest in this case would result in removing src contents
|
221
|
+
// and therefore a broken symlink would be created.
|
222
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
223
|
+
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))
|
224
|
+
}
|
225
|
+
return copyLink(resolvedSrc, dest, cb)
|
226
|
+
})
|
227
|
+
}
|
228
|
+
})
|
229
|
+
}
|
230
|
+
|
231
|
+
function copyLink (resolvedSrc, dest, cb) {
|
232
|
+
fs.unlink(dest, err => {
|
233
|
+
if (err) return cb(err)
|
234
|
+
return fs.symlink(resolvedSrc, dest, cb)
|
235
|
+
})
|
236
|
+
}
|
237
|
+
|
238
|
+
module.exports = copy
|