Class: Koofr

Defined in: src/koofr.coffee

Overview

Koofr API client

Instance Method Summary

Constructor Details

# (Koofr) constructor(endpoint)

Construct a new client

Parameters:

Returns:

  • ( Koofr ) — Koofr client instance

Instance Method Details

# (Koofr) authenticate(email, password) Bound

Authenticate the user

Parameters:

  • email ( String ) User's email or username
  • password ( String ) User's password

Returns:

  • ( Koofr ) — Koofr client instance

# (http.IncomingMessage) request(method, path, options) Bound

Internal helper to make requests to API

Parameters:

  • method ( String ) HTTP method (e.g. GET)
  • path ( String ) HTTP path (e.g. /api/v2/user)
  • options ( String ) Additional options for simple-http-client

Returns:

  • ( http.IncomingMessage ) — HTTP response

# (Array<Object>) mounts() Bound

List mounts

Returns:

  • ( Array<Object> ) — Array of mounts

# (Array<Object>) filesList(mountId, path) Bound

List files

Parameters:

  • mountId ( String ) Mount ID
  • path ( String ) Path to files

Returns:

  • ( Array<Object> ) — Array of files

# (Object) filesInfo(mountId, path) Bound

File info

Parameters:

  • mountId ( String ) Mount ID
  • path ( String ) Path to file

Returns:

  • ( Object ) — File info

# (void) filesMkdir(mountId, path, name) Bound

Create a new folder/directory

Parameters:

  • mountId ( String ) Mount ID
  • path ( String ) Parent path
  • name ( String ) New folder/directory name

# (void) filesRename(mountId, path, name) Bound

Rename a file/directory

Parameters:

  • mountId ( String ) Mount ID
  • path ( String ) Path to file/directory
  • name ( String ) New name

# (void) filesRemove(mountId, path) Bound

Remove a file/directory

Parameters:

  • mountId ( String ) Mount ID
  • path ( String ) Path to file/directory

# (void) filesCopy(mountId, path, toMountId, toPath) Bound

Copy a file/directory

Parameters:

  • mountId ( String ) Mount ID
  • path ( String ) Path to file/directory
  • toMountId ( String ) Destination mount ID
  • toPath ( String ) Destination path

# (void) filesMove(mountId, path, toMountId, toPath) Bound

Move a file/directory

Parameters:

  • mountId ( String ) Mount ID
  • path ( String ) Path to file/directory
  • toMountId ( String ) Destination mount ID
  • toPath ( String ) Destination path

# (http.IncomingMessage) filesGet(mountId, path, start, end) Bound

Get (download) a file/directory

Parameters:

  • mountId ( String ) Mount ID
  • path ( String ) Path to file/directory
  • start ( Number ) Start offset (optional)
  • end ( Number ) End offset (optional)

Returns:

  • ( http.IncomingMessage ) — HTTP response (file content stream)

# (Object) filesPut(mountId, path, name, data) Bound

Put (upload) a file

Parameters:

  • mountId ( String ) Mount ID
  • path ( String ) Path to parent directory
  • name ( String ) New file name
  • data ( String, Buffer, Stream ) File content (String, Buffer or Stream)

Returns:

  • ( Object ) — Upload info

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: