Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const get = (path, callback) =>
{
fswin.getAttributes(path, result =>
{
if (result === null)
{
// fswin does not return an error -- problem could be ENOENT,EPERM,etc
callback( new Error("unknown error") );
return;
}
let attrs = {};
for (let i in result)
{
if (i.startsWith("IS_"))
{
attrs[i] = result[i];
}
return new Promise((resolve, reject) => {
fswin.getAttributes(pathToItem, result => {
if (!result) {
reject(`Could not retrieve attributes for ${pathToItem}`);
}
const attributes: IAttributes = {
hidden: result!.IS_HIDDEN
};
resolve(attributes);
});
});
}