The Open Source kanban (built with Meteor). Keep variable/table/field names camelCase. For translations, only add Pull Request changes to wekan/i18n/en.i18n.json , other translations are done at https://transifex.com/wekan/wekan only.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
wekan/packages/wekan-cfs-base-package/api.md

5.6 KiB

cfs-base-package Public API

CollectionFS, Base package

API documentation automatically generated by docmeteor.

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

HELPERS

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

fsUtility.cloneFileRecord(rec, [options])  Anywhere

This method cloneFileRecord is defined in FS.Utility

Arguments

  • rec {FS.File|[FS.Collection filerecord](#FS.Collection filerecord)}

  • options {Object} (Optional)

    • full {Boolean} (Optional, Default = false)

    Set true to prevent certain properties from being omitted from the clone.

Returns {Object} Cloned filerecord

Makes a shallow clone of rec, filtering out some properties that might be present if it's an FS.File instance, but which we never want to be part of the stored filerecord.

This is a blacklist clone rather than a whitelist because we want the user to be able to specify whatever additional properties they wish.

In general, we expect the following whitelist properties used by the internal and external APIs:

_id, name, size, type, chunkCount, chunkSize, chunkSum, copies, createdAt, updatedAt, uploadedAt

Those properties, and any additional properties added by the user, should be present in the returned object, which is suitable for inserting into the backing collection or extending an FS.File instance.

FS.Utility.cloneFileRecord = function(rec, options) { ... base-common.js:71

fsUtility.defaultCallback([err])  Anywhere

This method defaultCallback is defined in FS.Utility

Arguments

Returns {undefined}

Can be used as a default callback for client methods that need a callback. Simply throws the provided error if there is one.

FS.Utility.defaultCallback = function defaultCallback(err) { ... base-common.js:96

fsUtility.defaultCallback([f], [err])  Anywhere

This method defaultCallback is defined in FS.Utility

Arguments

  • f {Function} (Optional)

A callback function, if you have one. Can be undefined or null.

  • err {Meteor.Error |[ Error ](# Error )|[ String](# String)} (Optional)

Error or error message (string)

Returns {Any} the callback result if any

Handle Error, creates an Error instance with the given text. If callback is a function, passes the error to that function. Otherwise throws it. Useful for dealing with errors in methods that optionally accept a callback.

FS.Utility.handleError = function(f, err, result) { ... base-common.js:120

fsUtility.noop()  Anywhere

This method noop is defined in FS.Utility

Use this to hand a no operation / empty function

FS.Utility.noop = function() { ... base-common.js:134

fsUtility.getFileExtension(name)  Anywhere

This method getFileExtension is defined in FS.Utility

Arguments

  • name {String}

A filename, filepath, or URL that may or may not have an extension.

Returns {String} The extension or an empty string if no extension found.

FS.Utility.getFileExtension = function utilGetFileExtension(name) { ... base-common.js:205

fsUtility.setFileExtension(name, ext)  Anywhere

This method setFileExtension is defined in FS.Utility

Arguments

  • name {String}

A filename that may or may not already have an extension.

  • ext {String}

An extension without leading period, which you want to be the new extension on name.

Returns {String} The filename with changed extension.

FS.Utility.setFileExtension = function utilSetFileExtension(name, ext) { ... base-common.js:222

fsUtility.binaryToBuffer(data)  Server

This method binaryToBuffer is defined in FS.Utility

Arguments

  • data {Uint8Array}

Returns {Buffer}

Converts a Uint8Array instance to a Node Buffer instance

FS.Utility.binaryToBuffer = function(data) { ... base-server.js:9

fsUtility.bufferToBinary(data)  Server

This method bufferToBinary is defined in FS.Utility

Arguments

  • data {Buffer}

Returns {Uint8Array}

Converts a Node Buffer instance to a Uint8Array instance

FS.Utility.bufferToBinary = function(data) { ... base-server.js:26

fsUtility.eachFile(e, f)  Client

This method eachFile is defined in FS.Utility

Arguments

Browser event

  • f {Function}

Function to run for each file found in the event.

Returns {undefined}

Utility for iteration over files in event

FS.Utility.eachFile = function(e, f) { ... base-client.js:37