Skip to content
Francesco edited this page Aug 11, 2014 · 5 revisions

The Greenworks API can be accessed by creating an instance of the related node module.

Example: var greenworks = require('./greenworks-osx');

if (greenworks.initAPI()) { console.log('Steam API initalised'); } else { console.log('Error initalising Steam API'); }

Once acquired, you can work on the greenworks object by using the methods and properties described as follows:

  • Greenworks.initAPI()
  • Greenworks.getCloudQuotas()
  • Greenworks.saveTextToFile(string fileName, string content, func success, func error)
  • Greenworks.readTextFromFile(string fileName, func success, func error)
  • Greenworks.activateAchievement(string achievementId, func success, func error)
  • Greenworks.enableCloud()
  • Greenworks.isCloudEnabled()
  • Greenworks.isCloudEnabledForUser()
  • Greenworks.getNumberOfPlayers()
  • Greenworks.ugcPublish(string fileName, string title, string description, string imageFile, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcPublishUpdate(int publishedFileId, string fileName, string title, string description, string imageFile, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcGetItems(int type, int sort, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcGetUserItems(int type, int sort, int filter, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcDownloadItem(string fileName, int hFile, string targetFolder, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcSynchronizeItems(string targetFolder, func success, func error, func progress)
  • Greenworks.getCurrentGameLanguage()
  • Greenworks.getCurrentUILanguage()
  • Greenworks.getSteamId()
  • Greenworks.ugcShowOverlay(optional workshopItemId)
  • Greenworks.ugcUnsubscribe(int publishedFileId, func success, func error, func progress)
  • Greenworks.getCurrentGameInstallDir()
  • Greenworks.runCallbacks()

Greenworks.Utils

  • Greenworks.Utils.createArchive(string zipFile, string sourceDir, string password, int compressionLevel, func success, func error)
  • Greenworks.Utils.extractArchive(string zipFile, string targetDir, string password, func success, func error)
  • Greenworks.Utils.sleep(int ms)
  • Greenworks.Utils.getOS(int ms)
  • Greenworks.Utils.move(string sourceFolder, string targetFolder)
  • Greenworks.Utils.enableConsole()
  • Greenworks.Utils.disableConsole()
  • Greenworks.Utils.enableWriteToLog(string targetFile)
  • Greenworks.Utils.disableWriteToLog()