Interface Resource

interface Resource {
    encoding?: string;
    onDidChangeContents?: Event<void>;
    onDidChangeReadOnly?: Event<boolean | MarkdownString>;
    readOnly?: boolean | MarkdownString;
    uri: URI;
    version?: ResourceVersion;
    dispose(): void;
    guessEncoding?(): Promise<undefined | string>;
    readContents(options?): Promise<string>;
    readStream?(options?): Promise<ReadableStream<string>>;
    saveContentChanges?(changes, options?): Promise<void>;
    saveContents?(content, options?): Promise<void>;
    saveStream?(content, options?): Promise<void>;
}

Hierarchy (view full)

Implemented by

Properties

encoding?: string

Latest read encoding of this resource.

Optional if a resource does not support encoding, check with in operator`. Undefined if a resource did not read content yet.

onDidChangeContents?: Event<void>
onDidChangeReadOnly?: Event<boolean | MarkdownString>
readOnly?: boolean | MarkdownString
uri: URI
version?: ResourceVersion

Latest read version of this resource.

Optional if a resource does not support versioning, check with in operator`. Undefined if a resource did not read content yet.

Methods

  • Reads latest content of this resource.

    If a resource supports versioning it updates version to latest. If a resource supports encoding it updates encoding to latest.

    Parameters

    Returns Promise<string>

    Throws

    ResourceError.NotFound if a resource not found

  • Applies incremental content changes to this resource.

    If a resource supports versioning clients can pass some version to check against it, if it is not provided latest version is used. It updates version to latest.

    Parameters

    Returns Promise<void>

    Throws

    ResourceError.NotFound if a resource not found or was not read yet

    Throws

    ResourceError.OutOfSync if latest resource version is out of sync with the given

  • Rewrites the complete content for this resource. If a resource does not exist it will be created.

    If a resource supports versioning clients can pass some version to check against it, if it is not provided latest version is used.

    It updates version and encoding to latest.

    Parameters

    Returns Promise<void>

    Throws

    ResourceError.OutOfSync if latest resource version is out of sync with the given

  • Rewrites the complete content for this resource. If a resource does not exist it will be created.

    If a resource supports versioning clients can pass some version to check against it, if it is not provided latest version is used.

    It updates version and encoding to latest.

    Parameters

    Returns Promise<void>

    Throws

    ResourceError.OutOfSync if latest resource version is out of sync with the given