How to use the fs-xattr.set function in fs-xattr

To help you get started, we’ve selected a few fs-xattr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github viddo / atom-textual-velocity / lib / service-consumers / NVTags.js View on Github external
write(path, str, callback) {
        var tags = str
          .trim()
          .split(" ")
          .reduce((memo, val) => {
            if (memo.indexOf(val) === -1) {
              memo.push(val);
            }
            return memo;
          }, []);

        if (tags.length && tags[0] !== "") {
          var plistBuf = bplist.create([tags]);
          xattr.set(path, XATTR_KEY, plistBuf, callback);
        } else {
          xattr.remove(path, XATTR_KEY, callback);
        }

        var now = new Date();
        fs.utimesSync(path, now, now); // update last access/update times
      }
    });
github wisnuc / appifi / test / fruitmix / unit / file / xstat.js View on Github external
it('should return default object if writelist is invalid in old-format', (done) => {
      xattr.set(fpath, FRUITMIX, JSON.stringify({
        uuid: uuid_1,
        owner: [uuid_2],
        writelist: 'Alice',
        readlist: [uuid_3]
      }), err => {
        if(err) return done(err)
        readXstat(fpath, (err, xstat) => {
          if(err) return done(err)
          expect(isUUID(xstat.uuid)).to.be.true
          expect(xstat.uuid).to.not.equal(uuid_1)
          expect(xstat.isDirectory()).to.be.true
          expect(xstat.writelist).to.be.an('undefined')
          expect(xstat.readlist).to.be.an('undefined')
          expect(xstat.abspath).to.deep.equal(fpath)
          done()
        })
github wisnuc / appifi / test / fruitmix / unit / file / xstat.js View on Github external
fs.stat(picpath, (err, stats) => {
        if(err) return done()
        xattr.set(picpath, FRUITMIX, JSON.stringify({
          uuid: uuid_1,
          hash: hash_1,
          htime: stats.mtime.getTime(),
          magic: 'JPEG'
        }), err => {
          if(err) return done(err)
          readXstat(picpath, (err, xstat) => {
            if(err) return done(err)
            xattr.get(picpath, FRUITMIX, (err, attr) => {
              if(err) return done(err)
              let attrObj = JSON.parse(attr)
              expect(attrObj.htime).to.equal(stats.mtime.getTime())

              expect(xstat.uuid).to.deep.equal(uuid_1)
              expect(xstat.isFile()).to.be.true
              expect(xstat.writelist).to.be.an('undefined')
github wisnuc / appifi / test / fruitmix / unit / file / xstat.js View on Github external
fs.stat(filepath, (err, stats) => {
              xattr.set(filepath, FRUITMIX, JSON.stringify({
                uuid: uuid_1,
                hash: hash_1,
                htime: stats.mtime.getTime()
              }), err => {
                if(err) return done(err)
                fs.writeFile(copypath, '', err => {
                  if(err) return done(err)
                  done()
                })
              })
            })
          })
github LinusU / node-appdmg / lib / util.js View on Github external
  util.callbackify(() => xattr.set(path, 'com.apple.FinderInfo', buf))(cb)
}

fs-xattr

Node.js module for manipulating extended attributes.

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Similar packages