chunpu / is-file-opened

Detect file opened in windows and mac

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is-file-opened

Detect file opened in windows and mac, based on opened and lsof-mac-fast

Installation

$ npm install is-file-opened --save

Api

detectFile(file)

detectFiles(files)

parseLsofRaw(lsofStr)

Usage

const path = require('path')
const isFileOpened = require('is-file-opened')

const file = path.join(__dirname, 'some.file')

isFileOpened.detectFile(file).then(function(opened) {
  console.log('opened', opened) // true or false
}).catch(err => {
  console.log('crash', err)
})

isFileOpened.detectFiles([file]).then(function(openedMap) {
  console.log('openedMap', openedMap) // { 'some.file': Boolean }
}).catch(err => {
  console.log('crash', err)
})

License

MIT

About

Detect file opened in windows and mac


Languages

Language:JavaScript 100.0%