Socket
Socket
Sign inDemoInstall

fs-native-extensions

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-native-extensions - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

92

index.js

@@ -1,6 +0,5 @@

const errors = require('uv-errors')
const binding = require('./binding')
function onwork (errno) {
if (errno < 0) this.reject(toError(errno))
function onwork (err) {
if (err) this.reject(err)
else this.resolve()

@@ -24,6 +23,5 @@ }

const errno = binding.fs_ext_napi_try_lock(fd, offset, length, opts.shared ? 0 : 1)
if (errno < 0) {
const err = toError(errno)
try {
binding.fs_ext_napi_try_lock(fd, offset, length, opts.shared ? 0 : 1)
} catch (err) {
if (err.code === 'EAGAIN') return false

@@ -63,6 +61,8 @@ throw err

const errno = binding.fs_ext_napi_wait_for_lock(req, fd, offset, length, opts.shared ? 0 : 1, ctx, onwork)
try {
binding.fs_ext_napi_wait_for_lock(req, fd, offset, length, opts.shared ? 0 : 1, ctx, onwork)
} catch (err) {
return Promise.reject(err)
}
if (errno < 0) return Promise.reject(toError(errno))
return promise

@@ -72,6 +72,5 @@ }

exports.tryDowngradeLock = function tryDowngradeLock (fd, offset = 0, length = 0) {
const errno = binding.fs_ext_napi_try_downgrade_lock(fd, offset, length)
if (errno < 0) {
const err = toError(errno)
try {
binding.fs_ext_napi_try_downgrade_lock(fd, offset, length)
} catch (err) {
if (err.code === 'EAGAIN') return false

@@ -97,6 +96,8 @@ throw err

const errno = binding.fs_ext_napi_wait_for_downgrade_lock(req, fd, offset, length, ctx, onwork)
try {
binding.fs_ext_napi_wait_for_downgrade_lock(req, fd, offset, length, ctx, onwork)
} catch (err) {
return Promise.reject(err)
}
if (errno < 0) return Promise.reject(toError(errno))
return promise

@@ -106,6 +107,5 @@ }

exports.tryUpgradeLock = function tryUpgradeLock (fd, offset = 0, length = 0) {
const errno = binding.fs_ext_napi_try_upgrade_lock(fd, offset, length)
if (errno < 0) {
const err = toError(errno)
try {
binding.fs_ext_napi_try_upgrade_lock(fd, offset, length)
} catch (err) {
if (err.code === 'EAGAIN') return false

@@ -131,6 +131,8 @@ throw err

const errno = binding.fs_ext_napi_wait_for_upgrade_lock(req, fd, offset, length, ctx, onwork)
try {
binding.fs_ext_napi_wait_for_upgrade_lock(req, fd, offset, length, ctx, onwork)
} catch (err) {
return Promise.reject(err)
}
if (errno < 0) return Promise.reject(toError(errno))
return promise

@@ -140,5 +142,3 @@ }

exports.unlock = function unlock (fd, offset = 0, length = 0) {
const errno = binding.fs_ext_napi_unlock(fd, offset, length)
if (errno < 0) throw toError(errno)
binding.fs_ext_napi_unlock(fd, offset, length)
}

@@ -159,6 +159,8 @@

const errno = binding.fs_ext_napi_trim(req, fd, offset, length, ctx, onwork)
try {
binding.fs_ext_napi_trim(req, fd, offset, length, ctx, onwork)
} catch (err) {
return Promise.reject(err)
}
if (errno < 0) return Promise.reject(toError(errno))
return promise

@@ -183,6 +185,8 @@ }

const errno = binding.fs_ext_napi_sparse(req, fd, ctx, onwork)
try {
binding.fs_ext_napi_sparse(req, fd, ctx, onwork)
} catch (err) {
return Promise.reject(err)
}
if (errno < 0) return Promise.reject(toError(errno))
return promise

@@ -204,21 +208,9 @@ }

const errno = binding.fs_ext_napi_swap(req, from, to, ctx, onwork)
try {
binding.fs_ext_napi_swap(req, from, to, ctx, onwork)
} catch (err) {
return Promise.reject(err)
}
if (errno < 0) return Promise.reject(toError(errno))
return promise
}
function toError (errno) {
const [code, msg] = errors.get(errno)
const err = new Error(`${code}: ${msg}`)
err.errno = errno
err.code = code
if (Error.captureStackTrace) {
Error.captureStackTrace(err, toError)
}
return err
}
{
"name": "fs-native-extensions",
"version": "1.2.2",
"version": "1.2.3",
"description": "Native file system extensions for advanced file operations",

@@ -33,4 +33,3 @@ "main": "index.js",

"napi-macros": "^2.0.0",
"node-gyp-build": "^4.2.3",
"uv-errors": "^1.0.1"
"node-gyp-build": "^4.2.3"
},

@@ -37,0 +36,0 @@ "devDependencies": {

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc