🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

bare-fs

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-fs - npm Package Compare versions

Comparing version
4.5.6
to
4.6.0
+2
-0
index.d.ts

@@ -274,2 +274,4 @@ import EventEmitter, { EventMap } from 'bare-events'

export function cpSync(src: Path, dst: Path, opts?: CpOptions): void
export function exists(filepath: Path): Promise<boolean>

@@ -276,0 +278,0 @@

+42
-18

@@ -1153,7 +1153,3 @@ const FIFO = require('fast-fifo')

if (opts.recursive !== true) {
throw new FileError('is a directory', {
operation: 'cp',
code: 'EISDIR',
path: src
})
throw new FileError('is a directory', { operation: 'cp', code: 'EISDIR', path: src })
}

@@ -1164,7 +1160,5 @@

} catch (e) {
if (e.code === 'ENOENT') {
await mkdir(dst, { mode: st.mode, recursive: true })
} else {
throw e
}
if (e.code !== 'ENOENT') throw e
await mkdir(dst, { mode: st.mode, recursive: true })
}

@@ -1187,2 +1181,31 @@

function cpSync(src, dst, opts = {}) {
src = toNamespacedPath(src)
dst = toNamespacedPath(dst)
const st = lstatSync(src)
if (st.isDirectory()) {
if (opts.recursive !== true) {
throw new FileError('is a directory', { operation: 'cp', code: 'EISDIR', path: src })
}
try {
lstatSync(dst)
} catch (e) {
if (e.code !== 'ENOENT') throw e
mkdirSync(dst, { mode: st.mode, recursive: true })
}
const dir = opendirSync(src)
for (const { name } of dir) {
cpSync(path.join(src, name), path.join(dst, name), opts)
}
} else if (st.isFile()) {
copyFileSync(src, dst)
chmodSync(dst, st.mode)
}
}
async function realpath(filepath, opts, cb) {

@@ -1344,6 +1367,2 @@ if (typeof opts === 'function') {

switch (type) {
case 'file':
default:
type = 0
break
case 'dir':

@@ -1355,2 +1374,6 @@ type = constants.UV_FS_SYMLINK_DIR

break
case 'file':
default:
type = 0
break
}

@@ -1401,6 +1424,2 @@ } else if (typeof type !== 'number') {

switch (type) {
case 'file':
default:
type = 0
break
case 'dir':

@@ -1412,2 +1431,6 @@ type = constants.UV_FS_SYMLINK_DIR

break
case 'file':
default:
type = 0
break
}

@@ -2319,2 +2342,3 @@ } else if (typeof type !== 'number') {

exports.copyFileSync = copyFileSync
exports.cpSync = cpSync
exports.existsSync = existsSync

@@ -2321,0 +2345,0 @@ exports.fchmodSync = fchmodSync

{
"name": "bare-fs",
"version": "4.5.6",
"version": "4.6.0",
"description": "Native file system operations for Javascript",

@@ -33,3 +33,5 @@ "exports": {

"scripts": {
"test": "prettier . --check && bare test.js"
"format": "prettier --write . && lunte --fix",
"lint": "prettier --check . && lunte",
"test": "brittle-bare --coverage test.js"
},

@@ -61,2 +63,3 @@ "repository": {

"cmake-bare": "^1.1.7",
"lunte": "^1.6.0",
"prettier": "^3.4.1",

@@ -63,0 +66,0 @@ "prettier-config-holepunch": "^2.0.0"

@@ -6,2 +6,4 @@ const EventEmitter = require('bare-events')

constructor(fd) {
super()
this.fd = fd

@@ -11,3 +13,3 @@ }

async close() {
await fs.close(fd)
await fs.close(this.fd)

@@ -14,0 +16,0 @@ this.fd = -1

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet