{"name":"fs-ext","version":"2.1.0","keywords":["fs","filesystem","flock","seek"],"author":{"url":"http://baudehlo.wordpress.com/","name":"Matt Sergeant","email":"helpme@gmail.com"},"_id":"fs-ext@2.1.0","homepage":"https://github.com/baudehlo/node-fs-ext/","bugs":{"url":"https://github.com/baudehlo/node-fs-ext/issues"},"dist":{"shasum":"fd24278040cb6c069228e01c142496de4833a0a3","tarball":"http://registry-npm.ywwl.com/fs-ext/download/fs-ext-2.1.0.tgz","fileCount":20,"integrity":"sha512-oAd29aPAYm/g9BitJ7x8bIzblp9EJlr9nKv7mzt+LoqZziYH7o7zFNKru1ykzbWTyB6ZLE5KoNdkahJiyzj/zg==","signatures":[{"sig":"MEQCIB5C+9lXTHWfW5uu9CHYUgI7Z+ABbZfFxVQJCVTUP8KFAiAxJqirvteb/j8m8G/ppyowv2nGTFB7mQwGYJJrohv5fA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80586,"size":16125,"noattachment":false,"key":"/fs-ext/-/fs-ext-2.1.0.tgz"},"main":"fs-ext.js","engines":{"node":">= 8.0.0"},"gitHead":"6f5f651893ca2025f6bed67a9bfd8b8ba5606ad4","scripts":{"lint":"node ./node_modules/eslint/bin/eslint \"*.js\" \"tests/**/*.js\"","test":"node ./run_tests","cover":"NODE_ENV=cov ./node_modules/.bin/istanbul cover node ./run_tests","install":"node-gyp configure build"},"_npmUser":{"name":"msergeant","email":"helpme@gmail.com"},"licenses":[{"type":"MIT"}],"repository":{"url":"git://github.com/baudehlo/node-fs-ext.git","type":"git"},"_npmVersion":"10.2.3","description":"Extensions to core 'fs' module.","directories":{},"_nodeVersion":"18.19.0","dependencies":{"nan":"^2.21.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^5.9.0"},"_npmOperationalInternal":{"tmp":"tmp/fs-ext_2.1.0_1730741944880_0.3619327298374131","host":"s3://npm-registry-packages"},"readme":"fs-ext\n======\n\n[![Build Status][ci-img]][ci-url]\n[![Coverage Status][cov-img]][cov-url]\n[![Windows Status][ci-win-img]][ci-win-url]\n\nExtras not included in Node's fs module.\n\n**Note**:\n\n* From `v2.0.0` onwards, module doesn't override `fs` and `constants` Node.js core modules. Instead\n  import functions and constants directly:\n\n  ```js\n  const {flock, constants} = require('fs-ext');\n  // or\n  const fsExt = require('fs-ext');\n  // fsExt.flock\n  // fsExt.constants\n  ```\n\n* From `v1.0.0` onwards, fs.utime and fs.utimeSync have been removed.\n  Use fs.utimes and fs.utimesSync instead.\n\nInstallation\n------------\n\nInstall via npm:\n\n```sh\nnpm install fs-ext\n```\n\nUsage\n-----\n\nfs-ext imports all of the methods from the core 'fs' module, so you don't\nneed two objects.\n\n```js\nconst fs = require('fs');\nconst {flock} = require('fs-ext');\n\nconst fd = fs.openSync('foo.txt', 'r');\nflock(fd, 'ex', (err) => {\n    if (err) {\n        return console.error(\"Couldn't lock file\");\n    }\n    // file is locked\n});\n```\n\nFor an advanced example checkout `example.js`.\n\nAPI\n---\n\n### flock(fd, flags, [callback])\n\nAsynchronous flock(2). No arguments other than a possible error are passed to\nthe callback. Flags can be 'sh', 'ex', 'shnb', 'exnb', 'un' and correspond\nto the various LOCK_SH, LOCK_EX, LOCK_SH|LOCK_NB, etc.\n\nNOTE (from flock() man page): flock() does not lock files over NFS. Use fcntl(2)\ninstead: that does work over NFS, given a sufficiently recent version of Linux\nand a server which supports locking.\n\n\n### flockSync(fd, flags)\n\nSynchronous flock(2). Throws an exception on error.\n\n### fcntl(fd, cmd, [arg], [callback])\n\nAsynchronous fcntl(2).\n\ncallback will be given two arguments (err, result).\n\nThe supported commands are:\n\n- 'getfd' ( F_GETFD )\n- 'setfd' ( F_SETFD )\n- 'setlk' ( F_SETLK )\n- 'getlk' ( F_GETLK )\n- 'setlkw' ( F_SETLKW )\n\nRequiring this module adds `FD_CLOEXEC` to the constants module, for use with F_SETFD,\nand also F_RDLCK, F_WRLCK and F_UNLCK for use with F_SETLK (etc).\n\nFile locking can be used like so:\n\n```js\nconst {fnctl, constants} = require('fs-ext');\n\nfcntl(fd, 'setlkw', constants.F_WRLCK, (err) => {\n    if (!err) {\n        // Lock succeeded\n    }\n});\n```\n\n### fcntlSync(fd, flags)\n\nSynchronous fcntl(2). Throws an exception on error.\n\n### seek(fd, offset, whence, [callback])\n\nAsynchronous lseek(2).\n\ncallback will be given two arguments (err, currFilePos).\n\nwhence can be 0 (SEEK_SET) to set the new position in bytes to offset,\n1 (SEEK_CUR) to set the new position to the current position plus offset\nbytes (can be negative), or 2 (SEEK_END) to set to the end of the file\nplus offset bytes (usually negative or zero to seek to the end of the file).\n\n### seekSync(fd, offset, whence)\n\nSynchronous lseek(2). Throws an exception on error.  Returns current\nfile position.\n\n\n\n[ci-img]: https://travis-ci.org/baudehlo/node-fs-ext.svg?branch=master\n[ci-url]: https://travis-ci.org/baudehlo/node-fs-ext\n[cov-img]: https://codecov.io/github/baudehlo/node-fs-ext/coverage.svg\n[cov-url]: https://codecov.io/github/baudehlo/node-fs-ext?branch=master\n[ci-win-img]: https://ci.appveyor.com/api/projects/status/pqbnutckk0n46uc8?svg=true\n[ci-win-url]: https://ci.appveyor.com/project/baudehlo/node-fs-ext/branch/master\n","publish_time":1730741945102,"maintainers":[{"name":"msergeant","email":"helpme@gmail.com"}],"_cnpm_publish_time":1730741945102,"dist-tags":{"latest":"2.1.1"}}