This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 40
data_transformers
Marcel Kloubert edited this page Dec 30, 2017
·
7 revisions
You can "transform" data (of a file) before it is send, or after it has been received from a source.
This is useful if you want to encrypt the data before it is send to a destination over a network connection and decrypt it after is has been received at the destination, e.g.
{
"deploy.reloaded": {
"targets": [
{
"type": "dropbox",
"name": "My DropBox folder",
"transformer": "./my-transformer_script.js",
"transformerOptions": "Any data, like scalar values, objects or arrays can be submitted to the script"
}
]
}
}
To do this, you have to create a JavaScript file, that has the following skeleton:
exports.transform = function(inputBuffer, context) {
if (0 == context.mode) {
// restore "transformed" data
// like decrypting
}
if (1 == context.mode) {
// transform data
// like encrypting
}
// you can return the new data as
// buffer, string or stream
// directly or via a promise
};
context
argument implements DataTransformerContext interface.
Relative paths will be mapped to your home directory (.vscode-deploy-reloaded
sub folder) or the .vscode
folder.