Socket
Socket
Sign inDemoInstall

fd-lock

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fd-lock - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

.travis.yml

10

package.json
{
"name": "fd-lock",
"version": "0.0.0",
"version": "0.0.1",
"description": "Advisory cross-platform lock on a file using a file descriptor to it.",
"main": "index.js",
"dependencies": {
"napi-macros": "^1.8.2"
"napi-macros": "^1.8.2",
"node-gyp-build": "^3.8.0"
},
"devDependencies": {
"prebuildify": "^2.11.0",
"tape": "^4.9.2"
},
"scripts": {
"test": "tape test.js"
"test": "tape test.js",
"prebuild": "prebuildify --napi",
"prebuild-ia32": "prebuildify --napi --arch=ia32"
},

@@ -15,0 +19,0 @@ "repository": {

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

# lock-fd
# fd-lock

@@ -6,9 +6,11 @@ Advisory cross-platform lock on a file using a file descriptor to it.

```
npm install lock-fd
npm install fd-lock
```
[![build status](https://travis-ci.org/mafintosh/fd-lock.svg?branch=master)](https://travis-ci.org/mafintosh/fd-lock)
## Usage
``` js
const lock = require('lock-fd')
const lock = require('fd-lock')

@@ -15,0 +17,0 @@ // Can we lock the file using the fd?

@@ -52,8 +52,9 @@ const tape = require('tape')

{
const { stdout } = spawnSync(process.execPath, [ '-e', `
const lock = require('${__dirname}')
const { stdout, stderr } = spawnSync(process.execPath, [ '-e', `
const lock = require(${JSON.stringify(__dirname)})
const { openSync } = require('fs')
console.log(lock(openSync('${__filename}', 'r')))
console.log(lock(openSync(${JSON.stringify(__filename)}, 'r')))
` ])
assert.same(stderr.toString(), '')
assert.same(stdout.toString().trim(), 'false', 'Other process could not lock')

@@ -65,8 +66,9 @@ }

{
const { stdout } = spawnSync(process.execPath, [ '-e', `
const lock = require('${__dirname}')
const { stdout, stderr } = spawnSync(process.execPath, [ '-e', `
const lock = require(${JSON.stringify(__dirname)})
const { openSync } = require('fs')
console.log(lock(openSync('${__filename}', 'r')))
console.log(lock(openSync(${JSON.stringify(__filename)}, 'r')))
` ])
assert.same(stderr.toString(), '')
assert.same(stdout.toString().trim(), 'true', 'Other process could lock')

@@ -73,0 +75,0 @@ }

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