0.3.0 • Published 5 years ago
native-file-monopolist v0.3.0
Native File Monopolist
Open a file handle exclusively and hold it, in order to other processes cannot access the file.
Install
npm install native-file-monopolistOr
yarn add native-file-monopolistBuild
yarn configure
yarn buildTest
yarn testUse
import { FileMonopolist } from 'native-file-monopolist';
const filePath = 'C:\\your-file-path';
const monopolist = new FileMonopolist(filePath);
console.log(monopolist.monopolized); // false
console.log(monopolist.filePath); // 'C:\\your-file-path'
const errorCode = monopolist.monopolize();
assert(errorCode === 0);
console.log(monopolist.monopolized); // true
const success = monopolist.dispose(); // true
console.log(monopolist.monopolized); // falseAPI
See index.d.ts file for details.