{"id":15642492,"url":"https://github.com/linusu/fs-xattr","last_synced_at":"2025-04-10T02:28:43.291Z","repository":{"id":12833633,"uuid":"15509051","full_name":"LinusU/fs-xattr","owner":"LinusU","description":"🔖 Node.js module for manipulating extended attributes","archived":false,"fork":false,"pushed_at":"2021-10-04T12:26:40.000Z","size":141,"stargazers_count":63,"open_issues_count":5,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-29T00:43:27.849Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LinusU.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-29T13:48:07.000Z","updated_at":"2024-03-22T11:32:17.000Z","dependencies_parsed_at":"2022-09-07T22:23:59.361Z","dependency_job_id":null,"html_url":"https://github.com/LinusU/fs-xattr","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Ffs-xattr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Ffs-xattr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Ffs-xattr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Ffs-xattr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinusU","download_url":"https://codeload.github.com/LinusU/fs-xattr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246916760,"owners_count":20854514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T11:56:27.528Z","updated_at":"2025-04-03T01:11:11.146Z","avatar_url":"https://github.com/LinusU.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fs-xattr\n\nNode.js module for manipulating extended attributes.\n\nThere are already some libraries for this, why use `fs-xattr`?\n\n- Very useful errors\n- No limits on value size\n- Clean and easy api\n- Proper asynchronous implementation\n\n## Installation\n\n```sh\nnpm install --save fs-xattr\n```\n\n## Usage\n\n```javascript\nimport { getAttribute, setAttribute } from 'fs-xattr'\n\nawait setAttribute('index.js', 'user.linusu.test', 'Hello, World!')\n\nconsole.log(await getAttribute('index.js', 'user.linusu.test'))\n//=\u003e Hello, World!\n```\n\n## API\n\n### `getAttribute(path, attr)`\n\n- `path` (`string`, required)\n- `attr` (`string`, required)\n- returns `Promise\u003cBuffer\u003e` - a `Promise` that will resolve with the value of the attribute.\n\nGet extended attribute `attr` from file at `path`.\n\n### `getAttributeSync(path, attr)`\n\n- `path` (`string`, required)\n- `attr` (`string`, required)\n- returns `Buffer`\n\nSynchronous version of `getAttribute`.\n\n### `setAttribute(path, attr, value)`\n\n- `path` (`string`, required)\n- `attr` (`string`, required)\n- `value` (`Buffer` or `string`, required)\n- returns `Promise\u003cvoid\u003e` - a `Promise` that will resolve when the value has been set.\n\nSet extended attribute `attr` to `value` on file at `path`.\n\n### `setAttributeSync(path, attr, value)`\n\n- `path` (`string`, required)\n- `attr` (`string`, required)\n- `value` (`Buffer` or `string`, required)\n\nSynchronous version of `setAttribute`.\n\n### `removeAttribute(path, attr)`\n\n- `path` (`string`, required)\n- `attr` (`string`, required)\n- returns `Promise\u003cvoid\u003e` - a `Promise` that will resolve when the value has been removed.\n\nRemove extended attribute `attr` on file at `path`.\n\n### `removeAttributeSync(path, attr)`\n\n- `path` (`string`, required)\n- `attr` (`string`, required)\n\nSynchronous version of `removeAttribute`.\n\n### `listAttributes(path)`\n\n- `path` (`string`, required)\n- returns `Promise\u003cArray\u003cstring\u003e\u003e` - a `Promise` that will resolve with an array of strings, e.g. `['user.linusu.test', 'com.apple.FinderInfo']`.\n\nList all attributes on file at `path`.\n\n### `listAttributesSync(path)`\n\n- `path` (`string`, required)\n- returns `Array\u003cstring\u003e`\n\nSynchronous version of `listAttributes`.\n\n## Namespaces\n\nFor the large majority of Linux filesystem there are currently 4 supported namespaces (`user`, `trusted`, `security`, and `system`) you can use. Some other systems, like FreeBSD have only 2 (`user` and `system`).\n\nBe sure to use a namespace that is appropriate for your supported platforms. You can read more about this in [the \"Extended File Attributes\" Wikipedia article](https://en.wikipedia.org/wiki/Extended_file_attributes#Implementations).\n\nUsing a namespace like `com.linusu.test` would work on macOS, but would give you the following error on Debian Linux:\n\n\u003e Error \\[ENOTSUP]: The file system does not support extended attributes or has the feature disabled.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Ffs-xattr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinusu%2Ffs-xattr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Ffs-xattr/lists"}