From the reference libraryRedM

File <BadgeShared/>

jo_libs/modules/file/shared.md

File <BadgeShared/>

A module to work with files in both client and server side

JO Functions > jo.file.isExist()

<!-- @include: ./slots/headers.md#shared|jo.file.isExist -->

Checks if a file exists <br>

<!-- @include: ./slots/descriptions.md#shared|jo.file.isExist -->

JO Functions > jo.file.isExist() > Syntax

jo.file.isExist(...)

JO Functions > jo.file.isExist() > Parameters

modname : string

The file location

JO Functions > jo.file.isExist() > Return Value

Type : boolean

Returns true if the file exists, false otherwise

<!-- @include: ./slots/examples.md#shared|jo.file.isExist -->

<!-- @include: ./slots/footers.md#shared|jo.file.isExist -->


JO Functions > jo.file.load()

<!-- @include: ./slots/headers.md#shared|jo.file.load -->

Loads and executes a Lua file <br>

<!-- @include: ./slots/descriptions.md#shared|jo.file.load -->

JO Functions > jo.file.load() > Syntax

jo.file.load(modname)

JO Functions > jo.file.load() > Parameters

modname : string

The file location

JO Functions > jo.file.load() > Return Value

Type : any

The result of the executed file, or false if there was an error

<!-- @include: ./slots/examples.md#shared|jo.file.load -->

<!-- @include: ./slots/footers.md#shared|jo.file.load -->


JO Functions > jo.file.read()

<!-- @include: ./slots/headers.md#shared|jo.file.read -->

Read a file and return it if it's exist or false. The function accept one or two arguments. <br> One argument: the filepath <br> Two argument: the resource AND the filepath <br>

<!-- @include: ./slots/descriptions.md#shared|jo.file.read -->

JO Functions > jo.file.read() > Syntax

jo.file.read(...)

JO Functions > jo.file.read() > Parameters

... : string

path of the file

JO Functions > jo.file.read() > Return Value

Type : file|boolean,resource|string,modpath|string

<!-- @include: ./slots/examples.md#shared|jo.file.read -->

<!-- @include: ./slots/footers.md#shared|jo.file.read -->

JO Functions > jo.file.loadJson()

<!-- @include: ./slots/headers.md#shared|jo.file.loadJson -->

Loads a JSON file and returns it decoded <br>

<!-- @include: ./slots/descriptions.md#shared|jo.file.loadJson -->

JO Functions > jo.file.loadJson() > Syntax

jo.file.loadJson(...)

JO Functions > jo.file.loadJson() > Parameters

... : string

path of the file, without the .json extension

JO Functions > jo.file.loadJson() > Return Value

Type : table|boolean

The decoded content of the file, or false if there was an error

<!-- @include: ./slots/examples.md#shared|jo.file.loadJson -->

<!-- @include: ./slots/footers.md#shared|jo.file.loadJson -->


JO Functions > jo.file.read() > Return Value

Type : file|boolean,resource|string,modpath|string

<!-- @include: ./slots/examples.md#shared|jo.file.read -->

<!-- @include: ./slots/footers.md#shared|jo.file.read -->


JO Functions > jo.file.readJson()

<!-- @include: ./slots/headers.md#shared|jo.file.readJson -->

Read a JSON file and return its content if it's exist or false. The function accept one or two arguments. <br> One argument: the filepath <br> Two argument: the resource AND the filepath <br>

<!-- @include: ./slots/descriptions.md#shared|jo.file.readJson -->

JO Functions > jo.file.readJson() > Syntax

jo.file.readJson(...)

JO Functions > jo.file.readJson() > Parameters

... : string

path of the file, without the .json extension

JO Functions > jo.file.readJson() > Return Value

Type : file|boolean,resource|string,modpath|string

<!-- @include: ./slots/examples.md#shared|jo.file.readJson -->

<!-- @include: ./slots/footers.md#shared|jo.file.readJson -->

Back to documentation