interface ExtensionStorageService {
    deleteUserData: (token: ExecutionToken, key: string) => Promise<void>;
    readBinaryFileFromInstallDirectory: (
        token: ExecutionToken,
        fileName: string,
    ) => Promise<Buffer>;
    readTextFileFromInstallDirectory: (
        token: ExecutionToken,
        fileName: string,
    ) => Promise<string>;
    readUserData: (token: ExecutionToken, key: string) => Promise<string>;
    writeUserData: (
        token: ExecutionToken,
        key: string,
        data: string,
    ) => Promise<void>;
}

Properties

deleteUserData: (token: ExecutionToken, key: string) => Promise<void>

Type declaration

    • (token: ExecutionToken, key: string): Promise<void>
    • Delete data previously written that is specific to the user (as identified by the OS) and extension (as identified by the ExecutionToken)

      Parameters

      • token: ExecutionToken

        ExecutionToken provided to the extension when activate() was called

      • key: string

        Unique identifier of the data

      Returns Promise<void>

      Promise that will resolve if the data is deleted successfully

readBinaryFileFromInstallDirectory: (
    token: ExecutionToken,
    fileName: string,
) => Promise<Buffer>

Type declaration

    • (token: ExecutionToken, fileName: string): Promise<Buffer>
    • Read a binary file from the the extension's installation directory

      Parameters

      • token: ExecutionToken

        ExecutionToken provided to the extension when activate() was called

      • fileName: string

        Name of the file to be read

      Returns Promise<Buffer>

      Promise for a Buffer with the contents of the file

readTextFileFromInstallDirectory: (
    token: ExecutionToken,
    fileName: string,
) => Promise<string>

Type declaration

    • (token: ExecutionToken, fileName: string): Promise<string>
    • Read a text file from the the extension's installation directory

      Parameters

      • token: ExecutionToken

        ExecutionToken provided to the extension when activate() was called

      • fileName: string

        Name of the file to be read

      Returns Promise<string>

      Promise for a string with the contents of the file

readUserData: (token: ExecutionToken, key: string) => Promise<string>

Type declaration

    • (token: ExecutionToken, key: string): Promise<string>
    • Read data specific to the user (as identified by the OS) and extension (as identified by the ExecutionToken)

      Parameters

      • token: ExecutionToken

        ExecutionToken provided to the extension when activate() was called

      • key: string

        Unique identifier of the data

      Returns Promise<string>

      Promise for a string containing the data

writeUserData: (
    token: ExecutionToken,
    key: string,
    data: string,
) => Promise<void>

Type declaration

    • (token: ExecutionToken, key: string, data: string): Promise<void>
    • Write data specific to the user (as identified by the OS) and extension (as identified by the ExecutionToken)

      Parameters

      • token: ExecutionToken

        ExecutionToken provided to the extension when activate() was called

      • key: string

        Unique identifier of the data

      • data: string

        Data to be written

      Returns Promise<void>

      Promise that will resolve if the data is written successfully