Class FileEnv

Hierarchy

  • FileEnv

Indexable

[name: string]: any

Constructors

  • Parameters

    • path: string = ".env"
    • old_process: ProcessEnv = process.env

    Returns FileEnv

Properties

#envPath: string
#old_process: Record<string, any>

Methods

  • Description

    Delete all variables from the file

    Example

    process.env.clear()
    

    Returns

    Returns void

  • Description

    Delete variable from file

    Example

    process.env.delete("token")
    

    Returns

    Parameters

    • key: string

      Type a key for the element

    Returns boolean

  • Description

    Delete and destroy the file

    Example

    process.env.destroy()
    

    Returns

    Returns void

  • Description

    Read variable from file

    Example

    process.env.get("token")
    

    Returns

    Parameters

    • key: string

      Type a key for the element

    Returns string

  • Description

    Check if a variable exists in the file

    Example

    process.env.has("token")
    

    Returns

    Parameters

    • key: string

      Type a key for the element

    Returns boolean

  • Returns void

  • Description

    Read variables in the file

    Example

    process.env.reloadVariables()()
    

    Returns

    Returns void

  • Description

    set variable in the file

    Example

    process.env.set("token","my_secret_token")
    

    Returns

    Parameters

    • key: string

      Type a key for the element

    • value: string

      Type a value for the element

    Returns void

  • Description

    To write an object to the file

    Example

    process.env.writeFile({token:"",prefix:"#"})
    

    Returns

    Parameters

    • Optional object: Record<string, string>

    Returns void

Generated using TypeDoc