Class JsStorageService

java.lang.Object
io.deephaven.web.client.api.storage.JsStorageService

@JsType(namespace="dh.storage", name="StorageService") public class JsStorageService extends Object
Remote service to read and write files on the server. Paths use "/" as a separator, and should not start with "/".
  • Constructor Details

    • JsStorageService

      @JsIgnore public JsStorageService(WorkerConnection connection)
  • Method Details

    • listItems

      @JsMethod public elemental2.promise.Promise<elemental2.core.JsArray<JsItemDetails>> listItems(String path, @JsOptional String glob)
      Lists items in a given directory, with an optional filter glob to only list files that match. The empty or "root" path should be specified as the empty string.
      Parameters:
      path - the path of the directory to list
      glob - optional glob to filter the contents of the directory
      Returns:
      a promise containing the any items that are present in the given directory that match the glob, or an error.
    • loadFile

      @JsMethod public elemental2.promise.Promise<JsFileContents> loadFile(String path, @JsOptional String etag)
      Downloads a file at the given path, unless an etag is provided that matches the file's current contents.
      Parameters:
      path - the path of the file to fetch
      etag - an optional etag from the last time the client saw this file
      Returns:
      a promise containing details about the file's contents, or an error.
    • deleteItem

      @JsMethod public elemental2.promise.Promise<Void> deleteItem(String path)
      Deletes the item at the given path. Directories must be empty to be deleted.
      Parameters:
      path - the path of the item to delete
      Returns:
      a promise with no value on success, or an error.
    • saveFile

      @JsMethod public elemental2.promise.Promise<JsFileContents> saveFile(String path, JsFileContents contents, @JsOptional Boolean allowOverwrite)
      Saves the provided contents to the given path, creating a file or replacing an existing one. The optional newFile parameter can be passed to indicate that an existing file must not be overwritten, only a new file created. Note that directories must be empty to be overwritten.
      Parameters:
      path - the path of the file to write
      contents - the contents to write to that path
      allowOverwrite - true to allow an existing file to be overwritten, false or skip to require a new file
      Returns:
      a promise with a FileContents, holding only the new etag (if the server emitted one), or an error
    • moveItem

      @JsMethod public elemental2.promise.Promise<Void> moveItem(String oldPath, String newPath, @JsOptional Boolean allowOverwrite)
      Moves (and/or renames) an item from its old path to its new path. The optional newFile parameter can be passed to enforce that an existing item must not be overwritten. Note that directories must be empty to be overwritten.
      Parameters:
      oldPath - the path of the existing item
      newPath - the new path to move the item to
      allowOverwrite - true to allow an existing file to be overwritten, false or skip to require a new file
      Returns:
      a promise with no value on success, or an error.
    • createDirectory

      @JsMethod public elemental2.promise.Promise<Void> createDirectory(String path)
      Creates a new directory at the specified path.
      Parameters:
      path - the path of the directory to create
      Returns:
      a promise with no value on success, or an error.