Options
All
  • Public
  • Public/Protected
  • All
Menu

Class File

The file class represents a file in nextcloud. It exposes file properties and content handling, commenting and tagging

Hierarchy

  • File

Implements

Index

Constructors

constructor

  • new File(client: Client, name: string, baseName: string, lastmod: string, size: number, mime: string, id: number): File
  • Parameters

    • client: Client
    • name: string
    • baseName: string
    • lastmod: string
    • size: number
    • mime: string
    • id: number

    Returns File

Accessors

baseName

  • get baseName(): string
  • The base name of the file (file name without path) The base name is readonly

    Returns string

id

  • get id(): number

lastmod

  • get lastmod(): Date
  • The timestamp of the last file change readonly

    Returns Date

mime

  • get mime(): string
  • The mime type (content type) of the file

    Returns string

name

  • get name(): string
  • The name of the file including the path The name is readonly

    Returns string

size

  • get size(): number
  • The file size in bytes readonly

    Returns number

Methods

addComment

  • addComment(comment: string): Promise<void>
  • add comment to file

    Parameters

    • comment: string

      the comment

    Returns Promise<void>

addTag

  • addTag(tagName: string): Promise<void>
  • adds a tag name to the file

    Parameters

    • tagName: string

      name of the tag

    Returns Promise<void>

delete

  • delete(): Promise<void>
  • deletes a file

    throws

    Error

    Returns Promise<void>

getComments

  • getComments(top?: undefined | number, skip?: undefined | number): Promise<string[]>
  • get list of comments of file

    throws

    Exception

    Parameters

    • Optional top: undefined | number

      number of comments to return

    • Optional skip: undefined | number

      the offset

    Returns Promise<string[]>

    array of comment strings

getContent

  • getContent(): Promise<Buffer>
  • throws

    Error

    Returns Promise<Buffer>

    the buffer of the file content

getFolder

  • getFolder(): Promise<Folder>
  • get folder of the file

    throws

    ClientError

    Returns Promise<Folder>

    the parent folder

getTags

  • getTags(): Promise<string[]>
  • get tag names

    Returns Promise<string[]>

    array of tag names

getUIUrl

  • getUIUrl(): string
  • throws

    Error

    Returns string

    the url of the file in the UI

getUrl

  • getUrl(): string
  • throws

    Error

    Returns string

    the url of the file

move

  • move(targetFileName: string): Promise<File>
  • moves or renames the current file to the new location target folder must exists

    throws

    Error

    Parameters

    • targetFileName: string

      the name of the target file /f1/f2/myfile.txt

    Returns Promise<File>

removeTag

  • removeTag(tagName: string): Promise<void>
  • removes a tag of the file

    Parameters

    • tagName: string

      the name of the tag

    Returns Promise<void>

Generated using TypeDoc