Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

Latest commit

 

History

History
271 lines (132 loc) · 7.53 KB

File metadata and controls

271 lines (132 loc) · 7.53 KB

cfs:access-point Public API

CollectionFS, add ddp and http accesspoint capability

API documentation automatically generated by docmeteor.

FSHTTP.setBaseUrl(newBaseUrl)  Anywhere

This method setBaseUrl is defined in FS.HTTP

Arguments

  • newBaseUrl {String}

Change the base URL for the HTTP GET and DELETE endpoints.

Returns {undefined}

FS.HTTP.setBaseUrl = function setBaseUrl(newBaseUrl) { ... access-point-common.js:29

fsFile.url([options])  Anywhere

This method url is defined in prototype of FS.File

Arguments

  • options {Object} (Optional)

    • store {String} (Optional)

    Name of the store to get from. If not defined, the first store defined in options.stores for the collection on the client is used.

    • auth {Boolean} (Optional, Default = null)

    Add authentication token to the URL query string? By default, a token for the current logged in user is added on the client. Set this to false to omit the token. Set this to a string to provide your own token. Set this to a number to specify an expiration time for the token in seconds.

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

    Should headers be set to force a download? Typically this means that clicking the link with this URL will download the file to the user's Downloads folder instead of displaying the file in the browser.

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

    Return the URL even if we know it's currently a broken link because the file hasn't been saved in the requested store yet.

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

    Return the URL for the file metadata access point rather than the file itself.

    • uploading {String} (Optional, Default = null)

    A URL to return while the file is being uploaded.

    • storing {String} (Optional, Default = null)

    A URL to return while the file is being stored.

    • filename {String} (Optional, Default = null)

    Override the filename that should appear at the end of the URL. By default it is the name of the file in the requested store.

Returns the HTTP URL for getting the file or its metadata.

FS.File.prototype.url = function(options) { ... access-point-common.js:72

FSHTTPHandlers.Del()  Server

This method Del is defined in FS.HTTP.Handlers

Returns {any} response

HTTP DEL request handler

FS.HTTP.Handlers.Del = function httpDelHandler(ref) { ... access-point-handlers.js:13

FSHTTPHandlers.GetList()  Server

This method GetList is defined in FS.HTTP.Handlers

Returns {Object} response

HTTP GET file list request handler

FS.HTTP.Handlers.GetList = function httpGetListHandler() { ... access-point-handlers.js:41

FSHTTPHandlers.Get()  Server

This method Get is defined in FS.HTTP.Handlers

Returns {any} response

HTTP GET request handler

FS.HTTP.Handlers.Get = function httpGetHandler(ref) { ... access-point-handlers.js:135

FSHTTPHandlers.PutInsert()  Server

This method PutInsert is defined in FS.HTTP.Handlers

Returns {Object} response object with _id property

HTTP PUT file insert request handler

FS.HTTP.Handlers.PutInsert = function httpPutInsertHandler(ref) { ... access-point-handlers.js:229

FSHTTPHandlers.PutUpdate()  Server

This method PutUpdate is defined in FS.HTTP.Handlers

Returns {Object} response object with _id and chunk properties

HTTP PUT file update chunk request handler

FS.HTTP.Handlers.PutUpdate = function httpPutUpdateHandler(ref) { ... access-point-handlers.js:264

FSHTTP.setHeadersForGet(headers, [collections])  Server

This method setHeadersForGet is defined in FS.HTTP

Arguments

  • headers {Array}

List of headers, where each is a two-item array in which item 1 is the header name and item 2 is the header value.

  • collections {Array|String} (Optional)

Which collections the headers should be added for. Omit this argument to add the header for all collections.

Returns {undefined}

FS.HTTP.setHeadersForGet = function setHeadersForGet(headers, collections) { ... access-point-server.js:24

FSHTTP.publish(collection, func)  Server

This method publish is defined in FS.HTTP

Arguments

Publish function that returns a cursor.

Returns {undefined}

Publishes all documents returned by the cursor at a GET URL with the format baseUrl/record/collectionName. The publish function this is similar to normal Meteor.publish.

FS.HTTP.publish = function fsHttpPublish(collection, func) { ... access-point-server.js:48

FSHTTP.unpublish(collection)  Server

This method unpublish is defined in FS.HTTP

Arguments

Returns {undefined}

Unpublishes a restpoint created by a call to FS.HTTP.publish

FS.HTTP.unpublish = function fsHttpUnpublish(collection) { ... access-point-server.js:73

FSHTTP.mount(mountPoints, selector_f)  Server

This method mount is defined in FS.HTTP

Arguments

  • mountPoints {[array of string](#array of string)}

mount points to map rest functinality on

  • selector_f {function}

[selector] function returns { collection, file } for mount points to work with

FS.HTTP.mount = function(mountPoints, selector_f) { ... access-point-server.js:125

FSHTTP.unmount([mountPoints])  Server

This method unmount is defined in FS.HTTP

Arguments

  • mountPoints {string |[ array of string](# array of string)} (Optional)

Optional, if not specified all mountpoints are unmounted

FS.HTTP.unmount = function(mountPoints) { ... access-point-server.js:223

FS.Collection maps on HTTP pr. default on the following restpoints:

baseUrl + '/files/:collectionName/:id/:filename', baseUrl + '/files/:collectionName/:id', baseUrl + '/files/:collectionName'

Change/ replace the existing mount point by:

unmount all existing
FS.HTTP.unmount();
Create new mount point
FS.HTTP.mount([
'/cfs/files/:collectionName/:id/:filename',
'/cfs/files/:collectionName/:id',
'/cfs/files/:collectionName'
]);