@panzi/getpass
    Preparing search index...

    Function getPass

    Read a password from the terminal.

    The user can delete the entered password via backspace, but no other editing features are supported at the moment. A password can contain a new line character by pressing Shift+Enter. Pasting is also supported, though escape sequences are also stripped from pasted text.

    The input is accepted when the user hits Ctrl+D, or when a new line, carriage return, or null byte is read.

    The user can abort by pressing Escape, Ctrl+C, or by a premature end of the input stream.

    The password or null if the user aborted.

    • Read a password from the terminal, decoded as a string from UTF-8.

      The user can delete the entered password via backspace, but no other editing features are supported at the moment. A password can contain a new line character by pressing Shift+Enter. Pasting is also supported, though escape sequences are also stripped from pasted text.

      The input is accepted when the user hits Ctrl+D, or when a new line, carriage return, or null byte is read.

      The user can abort by pressing Escape, Ctrl+C, or by a premature end of the input stream.

      Parameters

      • Optionalprompt: string

      Returns Promise<string | null>

      The password or null if the user aborted.

    • Read a password from the terminal, decoded as a string from the given encoding.

      The user can delete the entered password via backspace, but no other editing features are supported at the moment. A password can contain a new line character by pressing Shift+Enter. Pasting is also supported, though escape sequences are also stripped from pasted text.

      The input is accepted when the user hits Ctrl+D, or when a new line, carriage return, or null byte is read.

      The user can abort by pressing Escape, Ctrl+C, or by a premature end of the input stream.

      Parameters

      Returns Promise<string | null>

      The password or null if the user aborted.

    • Read a password from the terminal as a Buffer.

      The user can delete the entered password via backspace, but no other editing features are supported at the moment. A password can contain a new line character by pressing Shift+Enter. Pasting is also supported, though escape sequences are also stripped from pasted text.

      The input is accepted when the user hits Ctrl+D, or when a new line, carriage return, or null byte is read.

      The user can abort by pressing Escape, Ctrl+C, or by a premature end of the input stream.

      Parameters

      Returns Promise<Buffer<ArrayBufferLike> | null>

      The password or null if the user aborted.

    • Read a password from the terminal.

      The user can delete the entered password via backspace, but no other editing features are supported at the moment. A password can contain a new line character by pressing Shift+Enter. Pasting is also supported, though escape sequences are also stripped from pasted text.

      The input is accepted when the user hits Ctrl+D, or when a new line, carriage return, or null byte is read.

      The user can abort by pressing Escape, Ctrl+C, or by a premature end of the input stream.

      Parameters

      Returns Promise<string | Buffer<ArrayBufferLike> | null>

      The password or null if the user aborted.