fs-xattr

Node.js module for manipulating extended attributes.

fs-xattr

Node.js module for manipulating extended attributes.

There are already some libraries for this, why use fs-xattr?

  • Very useful errors
  • No limits on value size
  • Clean and easy api
npm install fs-xattr
var xattr = require('fs-xattr');

Get extended attribute attr from file at path.

cb is a callback that will be called with (err, val).

Synchronus version of xattr.get

Set extended attribute attr to value on file at path.

value can be either a string or a Buffer.

cb is a callback that will be called with (err).

Synchronus version of xattr.set

Remove extended attribute attr on file at path.

cb is a callback that will be called with (err).

Synchronus version of xattr.remove

List all attributes on file at path.

cb is a callback that will get called with (err, list). list in an array of strings, e.g. ['com.linusu.test', 'com.apple.FinderInfo'].

Synchronus version of xattr.list

AFAIK, neither the Linux or Darwin kernel supports manipulating extended attributes asynchronus. Thus the library currently wraps the synchronus calls with a simple process.nextTick to simulate non-blocking io.

One solution is to delegate the action away to another thread that will return a message upon completion. I think that this is more or less how node.js does fs internaly.

I obviously need to do more research on this.