Used to get the full root directory of the resource that this is called inside of.

Useful for writing content to the server specific resource folder if necessary.

Returns a string.


alt.rootDir: string


const directory = alt.rootDir;

Real World Example

import * as fs from 'fs';
import * as path from 'path';

const directory = alt.rootDir;
const textFilePath = path.join(directory, 'test.txt');

fs.appendFileSync(textFilePath, 'hello world');

These examples assume you have imported alt from alt-server.

results matching ""

    No results matching ""