{"_id":"fsctl","_rev":"3-6ca289d615ddf64ae900472489363f74","name":"fsctl","dist-tags":{"latest":"2.0.0"},"versions":{"0.0.0":{"name":"fsctl","version":"0.0.0","description":"WIP - nothing to see here","main":"index.js","dependencies":{},"devDependencies":{},"repository":{"type":"git","url":"git+https://github.com/mafintosh/fsctl.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/fsctl/issues"},"homepage":"https://github.com/mafintosh/fsctl","_id":"fsctl@0.0.0","_nodeVersion":"15.7.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-G9D+tJcuvFGUSYuB15KmbeuPw3Mumoa6xhxv5OJFFPlV+NIzUixgn2EaRdLetVqq1i4SnAdX0yJ5HpyNbBmObg==","shasum":"323e0a87ba74377300cca276438a359c26784463","tarball":"https://registry.npmjs.org/fsctl/-/fsctl-0.0.0.tgz","fileCount":4,"unpackedSize":2146,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgORijCRA9TVsSAnZWagAA5SYQAIsrdper8cSgvotKoldh\nD61yra4Iay0uSMByne+jnZR058rxPaj9CEQfAMF/P4uPP8V1dHohy3qM7x9r\n2kkCgEimfV+5FZMaDcVnNMExrlcKC7x7Ywv2OUuDoyqCDhz3v+CtIcq2sfs5\nw5iLBol4r9VWVbOknNGlFGzVTyR9SYfIiXoPtMwj3Z68MtzJlZEh2BRQnSXP\narKIWwBoAECJepCJLspeBfKCec/ySDzj5OBQoNjR+Fc1mlSaB6t78ALKy+v5\n3xiA6Pm81LBjXLXzis/sLqo05TR7LbIBCA6FDY/tRowdQJLkPzgTNtdBUuvI\n9tSdR1Q6WOyNj9NXF8Z0lZify6K3Qq6FnhApUdbV6NAiN6Gvzm74xZE7F+8g\nWKa+JmE/7iOxxCuZofPgcUTU90LafzzWBy9dqN6IGPRn4C5BR+U4xFLuVuLK\npggPZvOw/pk6YGpW25jpqwWvEXI7hdTUh8H0czgkcHk4r7kZmO9l70zGnBTB\nc/m0BVMyivT90GUoTTE/m2oICBKYe/dw3NTf0KE4mnJiV5xhw7I+z3ZTw9Fk\nxG9R8y4ZtUDlbl2SLv0jp4W9Tc3RgK/9YeGYd4UREhjaaeTjKr6BmcLDwUnI\n2/ofx5oY3jQWp7kz8jb2jgaMLU8rfBtf7/3iXinjE7AdBPZo3F2gbESt/j1j\n5VZn\r\n=D1iP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDy6OuRJoGF40YTIkYhzBnjPr5q2PTKmAH21VPsGSyK2AiBn+SWw4tgXXAb/hUdld8QLFcEs3t0uD/ASelfgqfiIDg=="}]},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fsctl_0.0.0_1614354594953_0.9822255345832025"},"_hasShrinkwrap":false},"1.0.0":{"name":"fsctl","version":"1.0.0","description":"Series of small native fd utils for manipulating file attributes and more","main":"index.js","dependencies":{"napi-macros":"^2.0.0","node-gyp-build":"^4.2.3"},"devDependencies":{"prebuildify":"^4.1.2","tape":"^4.9.2"},"scripts":{"test":"tape test.js","prebuild":"prebuildify --napi","prebuild-ia32":"prebuildify --napi --arch=ia32","install":"node-gyp-build"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/fsctl.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/fsctl/issues"},"homepage":"https://github.com/mafintosh/fsctl","gitHead":"381cc5d26f081c3ae582933459929753f3a8fe79","_id":"fsctl@1.0.0","_nodeVersion":"15.7.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-uNHlfhyUJiVO2kHA6ZBnDkBhG1wM8fII+xGfCi5aBoWR7DLh9Q3nOAWe4fEETQzkptahITI1xbe5r23HuA5ECA==","shasum":"6c1fdd9f11bddba23d1ff6f3bf29881b10bd5dd8","tarball":"https://registry.npmjs.org/fsctl/-/fsctl-1.0.0.tgz","fileCount":13,"unpackedSize":1112213,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgOR+iCRA9TVsSAnZWagAAnwoP/0lUgel+jo8y8r9eV/HC\n7ldr54p7S7e2RXpAVdsHhMEbdKfxCaMXbHJhhqitBD9voPdr4crjdc3geXJ3\nmN9HC1NHlsJfI9QGJXyyQ+awd09k/XIlwGzKjs0zggin3QrAxyVxfTDVdJ8z\neutfOMElT+Rg98rt1w/PJJ4uXcCbBWx8vwFZ4widIob5KRYJjU7u+r8arKu9\nY8MZwlJ/W7QHDz/qtPvpIyXWxbAxA9OOlGOVCR9lJl1YA21cCHXA83qzHcia\nMjwKk9XNnQeT3Z7ef1xmXzVqb00g4iWkfImD+TAsLhjvJ1MSg3T7umY8bglu\nzkgQWD/HZTw4/2gGze2m7AAOwBkoEgkOmrElYHgvIX3UDvBEkj13feXbZLVv\nhrlD3dRJsbam1ZwEup/h9zzMmANkKZPR9yIBk4TfW5IzN/sbKgpNAtpMENTa\nn0TxY6G4Q/KqoaB6LJ6PnZm6mYBvdiR63CgY6ZzNMrx58uR9S1hfvXZLWBu+\nepRZDS+5kggZAvyQTVe5DaI1NFEilVHOHD/1m75ZYubAW5vjNLaLNxwZUMFz\nRr1WkF2qjQndMBUxb+O/y6Hd4vyv0VIVkfIyk1uW/2Ktd8LWENVU2WfU1wKX\nCWJBqH+0lm1iuIa63tx4oqm3y3LEH9rPOEygGraphoJYVc5a/Zcrk8Y/cNdz\nbeCc\r\n=4eWU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDx5Pnd5TQnoFCbvMR8gtCQQNnGkolDdI6+kjybDJObvAiEAwwFco5Es5sm6898eADDhU2O4XvFS+nW5neBszaTH418="}]},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fsctl_1.0.0_1614356386039_0.5239934552360832"},"_hasShrinkwrap":false},"2.0.0":{"name":"fsctl","version":"2.0.0","description":"Native utilities for file manipulation, including locking and hole punching","main":"index.js","dependencies":{"napi-macros":"^2.0.0","node-gyp-build":"^4.2.3"},"devDependencies":{"brittle":"^2.3.1","minimist":"^1.2.6","nanobench":"^2.1.1","prebuildify":"^4.1.2","pretty-bytes":"^6.0.0","standard":"^17.0.0","tempy":"^3.0.0"},"scripts":{"test":"standard && brittle test/*.mjs","prebuild":"prebuildify --napi","install":"node-gyp-build"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/fsctl.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/fsctl/issues"},"homepage":"https://github.com/mafintosh/fsctl","gitHead":"6ba80620576d261427f8641c32f8d4d59bfe349a","_id":"fsctl@2.0.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-TbWp5Iz1HEcg76mWIoGScYiTFIM1iTe0cRN0hdwUfd4IgpvgWB0forIrmDXJHfBpV2aQ/qOjnh7RZ0azQKLlyw==","shasum":"6a25029aecd1a8bb287afbf9b3cc0029f173cede","tarball":"https://registry.npmjs.org/fsctl/-/fsctl-2.0.0.tgz","fileCount":26,"unpackedSize":276815,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCn/HKbcUW/t1P5wDnnY8FxvhH4Pdx9yBuwGPh4Ux1XNwIgdbhvtkBUejVHUeSPqkmRlcnBEpZmWbnbj0XdzjVEmDE="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJig5owACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqHvg/6A2obVQd1/3H2UfzLjlvNbwZQ4lxiOgdHNEdZ55kLApNnh5wT\r\nAPj7UvZvQZvrD8iaRgtRK56C8DDB+FSjAGSzWNeZahR4ZqZ+yjjt8VeSdw4c\r\nOi3LBIklbbUq3M1EOPVlb9io6zsOwHmEArfoiTddZCyfyavwMqn+iHp9NmnA\r\ny1VpQXPRqkGN6+SPhdIyr22dPyq4+1eSJqXPqUa3z5eiR9YxiNOFqNa2l1zm\r\ns2VrmLE4nXZk6/U3gobhn0PZMEQi1LBMxPQgi9PkPzO5k9rb43pURqS1ReaV\r\nsd+foNVdDVSq+SyEzjv5qi7p7VQKKT4Di5SISJEQlL4obd7Z8UoZcwRMgMEM\r\nlsL51rfqfZ++AfNHJ1IZHIO5OHgP3DxZ5pb6tZeDGlPoBGOUyO0z+QoxE5X/\r\nxcKpgUQy77f77Tv9O3aU+sIcENFXT8ZeHLZ+uhFkuFCAK4R3eTai8fFMMrId\r\nM7xF5mmCKgTYooyXnJSRUFGCIeCa6OmhxQUFxiBAWRnih1CjWVE81euiJLN8\r\nEt0svAciRmaDLC7JwR0qaQ59Bwae1hpbfPBQqIpidxIbq/UEzFuGDlNt1TaJ\r\nLvxvW8OzJQN8NdGGA5mYPYN00+g8a8/G0wPmXIo+hMLhcSF5oN4gkh1/sAfj\r\naxPP49eVihKH0k7E+cNwJg9oMmPxOl9Ck2k=\r\n=Ato0\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fsctl_2.0.0_1652791856668_0.5245928296757589"},"_hasShrinkwrap":false}},"time":{"created":"2021-02-26T15:49:54.953Z","0.0.0":"2021-02-26T15:49:55.316Z","modified":"2022-05-17T12:50:56.933Z","1.0.0":"2021-02-26T16:19:46.253Z","2.0.0":"2022-05-17T12:50:56.837Z"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"description":"Native utilities for file manipulation, including locking and hole punching","homepage":"https://github.com/mafintosh/fsctl","repository":{"type":"git","url":"git+https://github.com/mafintosh/fsctl.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"bugs":{"url":"https://github.com/mafintosh/fsctl/issues"},"license":"MIT","readme":"# fsctl\n\nNative utilities for file manipulation, including locking and hole punching.\n\n```\nnpm install fsctl\n```\n\n## Usage\n\nWrite to a file using an exclusive lock:\n\n``` js\nconst { open } = require('fs/promises')\nconst { lock, unlock } = require('fsctl')\n\nconst file = await open('file.txt', 'a+')\n\nawait lock(file.fd, { exclusive: true })\n\ntry {\n  await file.write('hello world')\n} finally {\n  unlock(file.fd)\n}\n```\n\n## API\n\n#### `await fsctl.lock(fd[, offset[, length]][, options])`\n\nRequest a process level lock on a file, resolving when the lock is granted. If another process holds the lock, the lock will not be granted until the other process either exits or releases the lock.\n\nTo lock only a portion of the file, `offset` and `length` may be passed. A `length` of `0` will request a lock from `offset` to the end of the file.\n\nNote that the lock is only advisory and there is nothing stopping another process from accessing the file by simply ignoring the lock.\n\nOptions include:\n\n```js\n{\n  // If `true`, request an exclusive lock, i.e. a write lock, on the file. By\n  // default, a shared lock, i.e. a read lock, is requested.\n  // Be aware that an exclusive lock can only be granted to files that are\n  // writable! A request for an exclusive lock on a read-only file is ignored \n  // and treated as a request for a shared lock.\n  exclusive: false\n}\n```\n\n#### `const granted = fsctl.tryLock(fd[, offset[, length]][, options])`\n\nRequest a process level lock on a file, returning `true` if the lock was granted or `false` if another process currently holds the lock.\n\nOptions are the same as `fsctl.lock()`.\n\n#### `fsctl.unlock(fd[, offset[, length]])`\n\nRelease a process level lock on a file.\n\n#### `await fsctl.punchHole(fd, offset, length)`\n\nPunch a hole in a file at `offset` for `length` bytes. On file systems that support sparse files, holes will take up no physical space.\n\nOn Windows, the file must first be marked sparse using `fsctl.sparse(fd)`. Otherwise, zeros will be explicitly written to the hole.\n\nOn macOS, the hole must be aligned to block boundaries as the call will otherwise fail.\n\n#### `await fsctl.sparse(fd)`\n\nMark a file as sparse. On Windows, this operation is required before holes can be punched in the file. On other systems, this operation has no effect.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}