Socket
Socket
Sign inDemoInstall

@npmcli/fs

Package Overview
Dependencies
3
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.2 to 3.0.0

lib/cp/errors.js

2

lib/cp/index.js

@@ -1,2 +0,2 @@

const fs = require('../fs.js')
const fs = require('fs/promises')
const getOptions = require('../common/get-options.js')

@@ -3,0 +3,0 @@ const node = require('../common/node.js')

@@ -26,3 +26,3 @@ // this file is a modified version of the code in node 17.2.0

ERR_INVALID_ARG_TYPE,
} = require('../errors.js')
} = require('./errors.js')
const {

@@ -49,3 +49,3 @@ constants: {

utimes,
} = require('../fs.js')
} = require('fs/promises')
const {

@@ -52,0 +52,0 @@ dirname,

@@ -0,12 +1,9 @@

'use strict'
const cp = require('./cp/index.js')
const withTempDir = require('./with-temp-dir.js')
module.exports = {
...require('./fs.js'),
copyFile: require('./copy-file.js'),
cp: require('./cp/index.js'),
mkdir: require('./mkdir.js'),
mkdtemp: require('./mkdtemp.js'),
rm: require('./rm/index.js'),
withTempDir: require('./with-temp-dir.js'),
withOwner: require('./with-owner.js'),
withOwnerSync: require('./with-owner-sync.js'),
writeFile: require('./write-file.js'),
cp,
withTempDir,
}
const { join, sep } = require('path')
const getOptions = require('./common/get-options.js')
const mkdir = require('./mkdir.js')
const mkdtemp = require('./mkdtemp.js')
const rm = require('./rm/index.js')
const { mkdir, mkdtemp, rm } = require('fs/promises')

@@ -15,6 +13,6 @@ // create a temp directory, ensure its permissions match its parent, then call

})
// create the directory, and fix its ownership
await mkdir(root, { recursive: true, owner: 'inherit' })
// create the directory
await mkdir(root, { recursive: true })
const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''), { owner: 'inherit' })
const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''))
let err

@@ -21,0 +19,0 @@ let result

{
"name": "@npmcli/fs",
"version": "2.1.2",
"version": "3.0.0",
"description": "filesystem utilities for the npm cli",

@@ -11,5 +11,2 @@ "main": "lib/index.js",

"scripts": {
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"snap": "tap",

@@ -37,16 +34,21 @@ "test": "tap",

"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.5.0",
"@npmcli/template-oss": "4.5.1",
"tap": "^16.0.1"
},
"dependencies": {
"@gar/promisify": "^1.1.3",
"semver": "^7.3.5"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.5.0"
"version": "4.5.1"
},
"tap": {
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
}
}

@@ -7,26 +7,5 @@ # @npmcli/fs

- all exposed functions return promises
- `fs.rm` polyfill for node versions < 14.14.0
- `fs.mkdir` polyfill adding support for the `recursive` and `force` options in node versions < 10.12.0
- `fs.copyFile` extended to accept an `owner` option
- `fs.mkdir` extended to accept an `owner` option
- `fs.mkdtemp` extended to accept an `owner` option
- `fs.writeFile` extended to accept an `owner` option
- `fs.cp` polyfill for node < 16.7.0
- `fs.withTempDir` added
- `fs.withOwner` added
- `fs.withOwnerSync` added
- `fs.cp` polyfill 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 the `uid` and `gid` explicitly
- `{ owner: 100 }` - use one value, will set both `uid` and `gid` the 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`

@@ -33,0 +12,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc