{"author":{"name":"Matt Sergeant","email":"helpme@gmail.com","url":"http://baudehlo.wordpress.com/"},"name":"fs-ext","description":"Extensions to core 'fs' module.","keywords":["fs","filesystem","flock","seek"],"version":"0.3.0","homepage":"https://github.com/baudehlo/node-fs-ext/","repository":{"type":"git","url":"git://github.com/baudehlo/node-fs-ext.git"},"main":"fs-ext.js","engines":{"node":">= v0.8.0"},"dependencies":{},"licenses":[{"type":"MIT"}],"bugs":{"mail":"helpme@gmail.com","url":"https://github.com/baudehlo/node-fs-ext/issues"},"scripts":{"install":"node-gyp configure build","test":"./run_tests"},"_id":"fs-ext@0.3.0","dist":{"shasum":"98c52caf0afdffa8d6e0ffab7a8a2930ea5f00b5","tarball":"http://registry-npm.ywwl.com/fs-ext/download/fs-ext-0.3.0.tgz","integrity":"sha512-SLqNihLjl6hSvqXdCiLltyLc1il1szujlV4oHDDmhPlxTFLQ0fqul30++EXE5tvDMMgsMtj1nWI/v+sCiKIfLg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDk2o89ABRUiXfWc5yuk620MWyfJzIv8vxUj1jBBlg6JwIhAMRIuLARTCQtTpIf0O4BDzGkqZbpzbg9/8PBjmUC7ww3"}],"size":13209,"noattachment":false,"key":"/fs-ext/-/fs-ext-0.3.0.tgz"},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"msergeant","email":"helpme@gmail.com"},"maintainers":[{"name":"msergeant","email":"helpme@gmail.com"}],"directories":{},"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":1363972615543,"_cnpm_publish_time":1363972615543,"dist-tags":{"latest":"2.1.1"}}