mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
# Conflicts: # jsowell-ui/.env.development # jsowell-ui/.env.staging # jsowell-ui/bin/build-sit.bat # jsowell-ui/bin/build.bat # jsowell-ui/src/api/adapayMember/adapayMember.js # jsowell-ui/src/api/pile/merchant.js # jsowell-ui/src/router/index.js # jsowell-ui/src/views/financial/financeDetail.vue # jsowell-ui/src/views/financial/merchant.vue # jsowell-ui/src/views/homeIndex/homeIndex.vue # jsowell-ui/src/views/login.vue # jsowell-ui/src/views/pile/basic/detail.vue # jsowell-ui/src/views/pile/station/components/SiteInfo.vue # jsowell-ui/src/views/pile/station/detail.vue # jsowell-ui/src/views/pile/station/orderReport.vue
@npmcli/fs
polyfills, and extensions, of the core fs module.
Features
- all exposed functions return promises
fs.rmpolyfill for node versions < 14.14.0fs.mkdirpolyfill adding support for therecursiveandforceoptions in node versions < 10.12.0fs.copyFileextended to accept anowneroptionfs.mkdirextended to accept anowneroptionfs.mkdtempextended to accept anowneroptionfs.writeFileextended to accept anowneroptionfs.withTempDiraddedfs.cppolyfill for node < 16.7.0
The owner option
The copyFile, mkdir, mkdtemp, writeFile, and withTempDir functions
all accept a new owner property in their options. It can be used in two ways:
{ owner: { uid: 100, gid: 100 } }- set theuidandgidexplicitly{ owner: 100 }- use one value, will set bothuidandgidthe same
The special string 'inherit' may be passed instead of a number, which will
cause this module to automatically determine the correct uid and/or gid
from the nearest existing parent directory of the target.
fs.withTempDir(root, fn, options) -> Promise
Parameters
root: the directory in which to create the temporary directoryfn: a function that will be called with the path to the temporary directoryoptionstmpPrefix: a prefix to be used in the generated directory name
Usage
The withTempDir function creates a temporary directory, runs the provided
function (fn), then removes the temporary directory and resolves or rejects
based on the result of fn.
const fs = require('@npmcli/fs')
const os = require('os')
// this function will be called with the full path to the temporary directory
// it is called with `await` behind the scenes, so can be async if desired.
const myFunction = async (tempPath) => {
return 'done!'
}
const main = async () => {
const result = await fs.withTempDir(os.tmpdir(), myFunction)
// result === 'done!'
}
main()