6min

$pinc

The $pinc library gives you access to some common functions used across Pathfix. Below are the list of common scenarios where you might use the library.



Get the Pathfix API Call URL or Revoke URL

Syntax

$pinc.getPathfixUrl(providerName, publicKey, userId)

$pinc.getPathfixRevokeUrl(providerName, publicKey, userId)

Remarks

Arguments

Description

providerName

Internal provider name. See Provider reference

publicKey

optional: Defaults to the public key specified in the data-public-key attribute of the script tag

userId

optional: Defaults to the data-user-id attribute of the script tag

Example

JS
|





Read Contents of a file before uploading to Online Storage

Syntax

$pinc.fileRead(FileReader, callback)

Returns

{"type": "HTTP_MIME_TYPE","content": "file_content", uploadObject:{}}

Remarks

Method Call

  • FileReader - required, Javascript FileReader Object
  • callback- callback function reference

Return

  • content - The raw file content.
  • uploadObject - Pass as a parameter to the payload when uploading the file using Pathfix passthrough Endpoints

Example

JS
|

Extended code from developer.mozilla.org



Updated 17 Nov 2020
Did this page help?
Yes
No