HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/node_modules/@akryum/winattr/lib/index.js
'use strict'
const checkWindows = require('./checkWindows')
const resolvePath = require('path').resolve
const whichLib = require('./whichLib')

function get (path, callback) {
  if (!callback) {
    return new Promise((resolve, reject) => {
      get(path, (err, result) => {
        if (err) {
          reject(err)
        } else {
          resolve(result)
        }
      })
    })
  }
  if (checkWindows.async(callback) === true) {
    return whichLib.run(function () {
      return whichLib.current().get(resolvePath(path), callback)
    })
  }
}

function getSync (path) {
  if (checkWindows.sync() === true) {
    return whichLib.run(function () {
      return whichLib.current().getSync(resolvePath(path))
    })
  }
}

function set (path, attrs, callback) {
  if (!callback) {
    return new Promise((resolve, reject) => {
      set(path, attrs, (err) => {
        if (err) {
          reject(err)
        } else {
          resolve()
        }
      })
    })
  }
  if (checkWindows.async(callback) === true) {
    return whichLib.run(function () {
      return whichLib.current().set(resolvePath(path), attrs, callback)
    })
  }
}

function setSync (path, attrs) {
  if (checkWindows.sync() === true) {
    return whichLib.run(function () {
      return whichLib.current().setSync(resolvePath(path), attrs)
    })
  }
}

whichLib.change('auto')

module.exports = {
  get,
  getSync,
  set,
  setSync,

  // Undocumented -- used for testing
  change: whichLib.change,
}