Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}
});