@kayahr/ed-journal
    Preparing search index...

    Class Journal

    Journal reader/watcher.

    Reads or watches a journal directory. It implements the AsyncIterable interface so for reading/watching the journal you simply iterate of the instance of this class with a for..of loop for example. If you prefer you can also use the next method to read the next event from the journal until this method returns null to indicate the end of the journal.

    In watch mode the iteration does not end and is continued every time a new event is appended to the journal by the game. Watch mode can be stopped by calling the close method. Iteration loops will end when journal is closed.

    Implements

    Index

    Methods

    • Returns PromiseLike<void>

    • Closes the journal by stopping the watcher (if any) and closing the line reader.

      Returns Promise<void>

    • Returns the journal directory.

      Returns string

      The journal directory.

    • Returns the next event from the journal. When end of journal is reached then in watch mode this method waits until a new event arrives. When not in watch mode or when journal is closed this method returns null when no more events are available.

      Returns Promise<AnyJournalEvent | null>

      The next journal event or null when end is reached.

    • Returns the current backpack inventory read from the Backpack.json file.

      Returns Promise<Backpack | null>

      The current backpack inventory. Null if Backpack.json file does not exist or is not readable.

    • Returns the current cargo data read from the Cargo.json file.

      Returns Promise<Backpack | null>

      The current cargo data. Null if Cargo.json file does not exist or is not readable.

    • Returns the current status read from the Status.json file.

      Returns Promise<Status | null>

      The current status. Null if Status.json file does not exist or is not readable.

    • Searches for the journal directory in common spaces. First it checks for existence of directory specified with environment variable ED_JOURNAL_DIR. Then it looks into the standard directory on a windows system and then it checks to standard directory within Proton (for Linux).

      If you know more common journal locations then please let me know so I can improve the search.

      Returns Promise<string>

      The found journal directory.

      JournalError - When journal directory was not found.

    • Finds the last position of the given event in the latest file of the journal and returns it. Returns end of journal if the latest journal file does not contain this event.

      Parameters

      • directory: string

        The journal directory.

      • eventName:
            | "ShipLocker"
            | "Backpack"
            | "CarrierBankTransfer"
            | "CarrierBuy"
            | "CarrierCrewServices"
            | "CarrierDepositFuel"
            | "CarrierDockingPermission"
            | "CarrierFinance"
            | "SearchAndRescue"
            | "CarrierJump"
            | "CarrierJumpCancelled"
            | "CarrierJumpRequest"
            | "CarrierLocation"
            | "CarrierModulePack"
            | "CarrierNameChange"
            | "CarrierShipPack"
            | "CarrierStats"
            | "CarrierTradeOrder"
            | "Bounty"
            | "CapShipBond"
            | "Died"
            | "EscapeInterdiction"
            | "FactionKillBond"
            | "FighterDestroyed"
            | "HeatDamage"
            | "HeatWarning"
            | "HullDamage"
            | "Interdicted"
            | "Interdiction"
            | "PVPKill"
            | "ShieldState"
            | "ShipTargeted"
            | "SRVDestroyed"
            | "UnderAttack"
            | "BuyExplorationData"
            | "CodexEntry"
            | "DiscoveryScan"
            | "FSSAllBodiesFound"
            | "FSSBodySignals"
            | "FSSDiscoveryScan"
            | "FSSSignalDiscovered"
            | "MaterialCollected"
            | "MaterialDiscarded"
            | "MaterialDiscovered"
            | "MultiSellExplorationData"
            | "NavBeaconScan"
            | "SAAScanComplete"
            | "SAASignalsFound"
            | "Scan"
            | "ScanBaryCentre"
            | "Screenshot"
            | "SellExplorationData"
            | "BackpackChange"
            | "BookDropship"
            | "BookTaxi"
            | "BuyMicroResources"
            | "BuySuit"
            | "BuyWeapon"
            | "CancelDropship"
            | "CancelTaxi"
            | "CollectItems"
            | "CreateSuitLoadout"
            | "DeleteSuitLoadout"
            | "Disembark"
            | "DropItems"
            | "DropshipDeploy"
            | "Embark"
            | "FCMaterials"
            | "LoadoutEquipModule"
            | "RenameSuitLoadout"
            | "ScanOrganic"
            | "SellMicroResources"
            | "SellOrganicData"
            | "SellSuit"
            | "SellWeapon"
            | "SuitLoadout"
            | "SwitchSuitLoadout"
            | "TradeMicroResources"
            | "TransferMicroResources"
            | "UpgradeSuit"
            | "UpgradeWeapon"
            | "UseConsumable"
            | "AfmuRepairs"
            | "ApproachSettlement"
            | "CargoTransfer"
            | "ChangeCrewRole"
            | "CockpitBreached"
            | "ColonisationConstructionDepot"
            | "ColonisationContribution"
            | "CommitCrime"
            | "Continued"
            | "CrewLaunchFighter"
            | "CrewMemberJoins"
            | "CrewMemberQuits"
            | "CrewMemberRoleChange"
            | "CrimeVictim"
            | "DatalinkScan"
            | "DatalinkVoucher"
            | "DataScanned"
            | "DockFighter"
            | "DockSRV"
            | "EndCrewSession"
            | "FighterRebuilt"
            | "Friends"
            | "FuelScoop"
            | "JetConeBoost"
            | "JetConeDamage"
            | "JoinACrew"
            | "KickCrewMember"
            | "LaunchDrone"
            | "LaunchFighter"
            | "LaunchSRV"
            | "ModuleInfo"
            | "Music"
            | "NpcCrewPaidWage"
            | "NpcCrewRank"
            | "Promotion"
            | "ProspectedAsteroid"
            | "QuitACrew"
            | "RebootRepair"
            | "ReceiveText"
            | "RepairDrone"
            | "ReservoirReplenished"
            | "Resupply"
            | "Resurrect"
            | "Scanned"
            | "SelfDestruct"
            | "SendText"
            | "Shutdown"
            | "SupercruiseDestinationDrop"
            | "Synthesis"
            | "SystemsShutdown"
            | "USSDrop"
            | "VehicleSwitch"
            | "WingAdd"
            | "WingInvite"
            | "WingJoin"
            | "WingLeave"
            | "DeliverPowerMicroResources"
            | "PowerplayCollect"
            | "PowerplayDefect"
            | "PowerplayDeliver"
            | "PowerplayFastTrack"
            | "PowerplayJoin"
            | "PowerplayLeave"
            | "PowerplayMerits"
            | "PowerplayRank"
            | "PowerplaySalary"
            | "PowerplayVote"
            | "PowerplayVoucher"
            | "AppliedToSquadron"
            | "InvitedToSquadron"
            | "JoinedSquadron"
            | "LeftSquadron"
            | "SharedBookmarkToSquadron"
            | "SquadronCreated"
            | "SquadronDemotion"
            | "SquadronPromotion"
            | "SquadronStartup"
            | "Cargo"
            | "ClearSavedGame"
            | "Commander"
            | "Fileheader"
            | "LoadGame"
            | "Loadout"
            | "Materials"
            | "Missions"
            | "NewCommander"
            | "Passengers"
            | "Powerplay"
            | "Progress"
            | "Rank"
            | "Reputation"
            | "Statistics"
            | "BuyAmmo"
            | "BuyDrones"
            | "CargoDepot"
            | "CommunityGoal"
            | "CommunityGoalDiscard"
            | "CommunityGoalJoin"
            | "CommunityGoalReward"
            | "CrewAssign"
            | "CrewFire"
            | "CrewHire"
            | "EngineerApply"
            | "EngineerContribution"
            | "EngineerCraft"
            | "EngineerLegacyConvert"
            | "EngineerProgress"
            | "FetchRemoteModule"
            | "Market"
            | "MassModuleStore"
            | "MaterialTrade"
            | "MissionAbandoned"
            | "MissionAccepted"
            | "MissionCompleted"
            | "MissionFailed"
            | "MissionRedirected"
            | "ModuleBuy"
            | "ModuleBuyAndStore"
            | "ModuleRetrieve"
            | "ModuleSell"
            | "ModuleSellRemote"
            | "ModuleStore"
            | "ModuleSwap"
            | "Outfitting"
            | "PayBounties"
            | "PayFines"
            | "PayLegacyFines"
            | "RedeemVoucher"
            | "RefuelAll"
            | "RefuelPartial"
            | "Repair"
            | "RepairAll"
            | "RestockVehicle"
            | "ScientificResearch"
            | "SellDrones"
            | "SellShipOnRebuy"
            | "SetUserShipName"
            | "ShipRedeemed"
            | "Shipyard"
            | "ShipyardBankDeposit"
            | "ShipyardBuy"
            | "ShipyardNew"
            | "ShipyardRedeem"
            | "ShipyardSell"
            | "ShipyardSwap"
            | "ShipyardTransfer"
            | "StoredModules"
            | "StoredShips"
            | "TechnologyBroker"
            | "AsteroidCracked"
            | "BuyTradeData"
            | "CollectCargo"
            | "EjectCargo"
            | "MarketBuy"
            | "MarketSell"
            | "MiningRefined"
            | "ApproachBody"
            | "Docked"
            | "DockingCancelled"
            | "DockingDenied"
            | "DockingGranted"
            | "DockingRequested"
            | "DockingTimeout"
            | "FSDJump"
            | "FSDTarget"
            | "LeaveBody"
            | "Liftoff"
            | "Location"
            | "NavRoute"
            | "NavRouteClear"
            | "StartJump"
            | "SupercruiseEntry"
            | "SupercruiseExit"
            | "Touchdown"
            | "Undocked"

        The event name to look for.

      Returns Promise<JournalPosition>

      Last position of given event in latest journal file or end of journal if not found.