{"_id":"@humanfs/node@0.17.0","bugs":{"url":"https://github.com/humanwhocodes/humanfs/issues"},"dist":{"shasum":"7d4ae51cc6745e3bf5c7c11dbfccacfc3c2afb19","tarball":"http://registry-npm.ywwl.com/@humanfs/node/download/@humanfs/node-0.17.0.tgz","fileCount":7,"integrity":"sha512-XFwVlKpp0UO2cAr+Jz+kIpZX0YSNU08XJucvFJeQxMA+IE8ySUAN5CE3j9bIUTaJs/ICka2bjn8fHzXKe3VF4Q==","signatures":[{"sig":"MEUCIHO4c3JMZPdnVJun2a5E6SdvAKdzHIQw+v88vPIcosKtAiEA/lhEchSbLhRLHCKaWm68VnaIuQIiSOKGFd6b87M2lus=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIATX95wbseEZKJ3g+VLief+2Oqi56+bh2xXrJ4TFJEx3AiEAroZCu+C94hxdW8YIXnTfMjNqi5RY4kyv2FfTFh3mvik="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@humanfs%2fnode@0.17.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":37750,"size":8969,"noattachment":false,"key":"/@humanfs/node/-/@humanfs/node-0.17.0.tgz"},"main":"dist/index.js","name":"@humanfs/node","type":"module","types":"dist/index.d.ts","author":{"name":"Nicholas C. Zakas"},"engines":{"node":">=24.0.0"},"exports":{"import":{"types":"./dist/index.d.ts","default":"./src/index.js"}},"gitHead":"0d5dfacb91c7cebe31d9d4494fed271466327498","license":"Apache-2.0","scripts":{"test":"mocha ./tests/","build":"tsc","prepare":"npm run build","pretest":"npm run build"},"version":"0.17.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:7beaedbb-6f96-481a-893e-ed9a9c4ed96e"}},"homepage":"https://github.com/humanwhocodes/humanfs#readme","keywords":["filesystem","fs","hfs","files"],"repository":{"url":"git+https://github.com/humanwhocodes/humanfs.git","type":"git","directory":"packages/node"},"_npmVersion":"11.19.0","description":"The Node.js bindings of the humanfs library.","directories":{},"maintainers":[{"name":"nzakas","email":"nicholas@nczconsulting.com"}],"_nodeVersion":"24.20.0","dependencies":{"@humanfs/core":"^0.20.0","@humanfs/types":"^0.16.0","@humanwhocodes/retry":"^0.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.2.0","typescript":"^5.2.2","@types/node":"^24.0.0","@humanfs/test":"^0.16.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/node_0.17.0_1789044578249_0.6355093348329619"},"readme":"# `@humanfs/node`\n\nby [Nicholas C. Zakas](https://humanwhocodes.com)\n\nIf you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star.\n\n## Description\n\nThe `hfs` bindings for use in Node.js and Node.js-compatible runtimes.\n\n> [!WARNING]\n> This project is **experimental** and may change significantly before v1.0.0. Use at your own caution and definitely not in production!\n\n## Installation\n\nInstall using your favorite package manager:\n\n```shell\nnpm install @humanfs/node\n\n# or\n\npnpm install @humanfs/node\n\n# or\n\nyarn add @humanfs/node\n\n# or\n\nbun install @humanfs/node\n```\n\n## Usage\n\nThe easiest way to use hfs in your project is to import the `hfs` object:\n\n```js\nimport { hfs } from \"@humanfs/node\";\n```\n\nThen, you can use the API methods:\n\n```js\n// 1. Files\n\n// read from a text file\nconst text = await hfs.text(\"file.txt\");\n\n// read from a JSON file\nconst json = await hfs.json(\"file.json\");\n\n// read raw bytes from a text file\nconst arrayBuffer = await hfs.arrayBuffer(\"file.txt\");\n\n// write text to a file\nawait hfs.write(\"file.txt\", \"Hello world!\");\n\n// write bytes to a file\nawait hfs.write(\"file.txt\", new TextEncoder().encode(\"Hello world!\"));\n\n// append text to a file\nawait hfs.append(\"file.txt\", \"Hello world!\");\n\n// append bytes to a file\nawait hfs.append(\"file.txt\", new TextEncoder().encode(\"Hello world!\"));\n\n// does the file exist?\nconst found = await hfs.isFile(\"file.txt\");\n\n// how big is the file?\nconst size = await hfs.size(\"file.txt\");\n\n// when was the file modified?\nconst mtime = await hfs.lastModified(\"file.txt\");\n\n// copy a file from one location to another\nawait hfs.copy(\"file.txt\", \"file-copy.txt\");\n\n// move a file from one location to another\nawait hfs.move(\"file.txt\", \"renamed.txt\");\n\n// delete a file\nawait hfs.delete(\"file.txt\");\n\n// 2. Directories\n\n// create a directory\nawait hfs.createDirectory(\"dir\");\n\n// create a directory recursively\nawait hfs.createDirectory(\"dir/subdir\");\n\n// does the directory exist?\nconst dirFound = await hfs.isDirectory(\"dir\");\n\n// copy the entire directory\nhfs.copyAll(\"from-dir\", \"to-dir\");\n\n// move the entire directory\nhfs.moveAll(\"from-dir\", \"to-dir\");\n\n// delete a directory\nawait hfs.delete(\"dir\");\n\n// delete a non-empty directory\nawait hfs.deleteAll(\"dir\");\n```\n\nIf you'd like to create your own instance, import the `NodeHfs` constructor:\n\n```js\nimport { NodeHfs } from \"@humanfs/node\";\nimport fsp from \"fs/promises\";\n\nconst hfs = new NodeHfs();\n\n// optionally specify the fs/promises object to use\nconst hfs = new NodeHfs({ fsp });\n```\n\nIf you'd like to use just the impl, import the `NodeHfsImpl` constructor:\n\n```js\nimport { NodeHfsImpl } from \"@humanfs/node\";\nimport fsp from \"fs/promises\";\n\nconst hfs = new NodeHfsImpl();\n\n// optionally specify the fs/promises object to use\nconst hfs = new NodeHfsImpl({ fsp });\n```\n\n## Errors Handled\n\n* `ENOENT` - in most cases, these errors are handled silently.\n* `ENFILE` and `EMFILE` - calls that result in these errors are retried for up to 60 seconds before giving up for good.\n\n## License\n\nApache 2.0\n","publish_time":1789044578339,"_cnpm_publish_time":1789044578339,"dist-tags":{"latest":"0.17.0"}}