wekan/packages/wekan-cfs-storage-adapter/internal.api.md
2021-04-29 13:26:49 +03:00

3.1 KiB

File: "storageAdapter.server.js" Where: {server}

#############################################################################

STORAGE ADAPTER

#############################################################################

self.insert(fsFile, [options], [callback])  Server

Attempts to insert a file into the store, first running the beforeSave
function for the store if there is one. If there is a temporary failure,
returns (or passes to the second argument of the callback) `null`. If there
is a permanant failure or the beforeSave function returns `false`, returns
`false`. If the file is successfully stored, returns an object with file
info that the FS.Collection can save.
Also updates the `files` collection for this store to save info about this
file.

This method insert is defined in self

Arguments

  • fsFile {FS.File}
    The FS.File instance to be stored.
  • options {Object} (Optional) Options (currently unused)
  • callback {Function} (Optional) If not provided, will block and return file info.

self.insert = function(fsFile, options, callback) { ... storageAdapter.server.js:169

self.update(fsFile, [options], [callback])  Server

Attempts to update a file in the store, first running the beforeSave
function for the store if there is one. If there is a temporary failure,
returns (or passes to the second argument of the callback) `null`. If there
is a permanant failure or the beforeSave function returns `false`, returns
`false`. If the file is successfully stored, returns an object with file
info that the FS.Collection can save.
Also updates the `files` collection for this store to save info about this
file.

This method update is defined in self

Arguments

  • fsFile {FS.File}
    The FS.File instance to be stored.
  • options {Object} (Optional) Options (currently unused)
  • callback {Function} (Optional) If not provided, will block and return file info.

self.update = function(fsFile, options, callback) { ... storageAdapter.server.js:264

self.remove(fsFile, [options], [callback])  Server

Attempts to remove a file from the store. Returns true if removed, or false.
Also removes file info from the `files` collection for this store.

This method remove is defined in self

Arguments

  • fsFile {FS.File}
    The FS.File instance to be stored.
  • options {Object} (Optional) Options
    • ignoreMissing {Boolean} (Optional) Set true to treat missing files as a successful deletion. Otherwise throws an error.
  • callback {Function} (Optional) If not provided, will block and return true or false

self.remove = function(fsFile, options, callback) { ... storageAdapter.server.js:321