Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
contensis-sync-api
Advanced tools
Allows you to Query Contensis with relevant credentials in order to sync files
You will need Contensis 9 to use this plugin, to get started, install contensis-sync-api
as a development dependency:
npm install --save-dev contensis-sync-api
Now create an instance of the API
var contensisSyncAPI = require('contensis-sync-api');
var ContensisSyncApiInstance = contensisSyncAPI.create({
"user": "user",
"password": "pass",
"cmsUrl": "http://contensis-cms-url",
"project": "Project Name"
});
Creates an instance of the Sync API to interact with
The Config object is used to create a REST connection to Contensis, you should ideally add your contensis credentials to a json file:
{
"user": "user",
"password": "pass",
"cmsUrl": "http://full-cms-url",
"project": "Project Name"
}
You can then read it in with:
var fs = require('fs')
//Remember to add your contensis-credentials.json to your .gitignore, so no one else can use your details!
var credentials = JSON.parse(fs.readFileSync('../contensis-credentials.json', 'utf8'))
//Now you can create the object using the credentials
var ContensisSyncApiInstance = contensisSyncAPI.create(credentials);
Get an object from contensis along with its ETag.
ContensisSyncApiInstance.getObject({ path: 'foo/bar.txt' }, function(err, rsp){
// The return object is very lightweight, because we are just interested in syncing files we really only care
// about the MD5 hash of the file.
var ETag = rsp.ETag;
var success = rsp.Success
//Do something
});
List all files on a particular path that exist.
function listObjects(cb){
listItems = ContensisSyncApiInstance.listObjects({ Prefix: 'foo' }, function(err, paths){
if(err){ return cb(err); }
for (let path of paths) {
console.log(path)
}
return cb();
});
}
List all files on a particular path that exist.
function deleteObjects(cb){
deleteItems = ContensisSyncApiInstance.deleteObjects(['foo/1.txt', 'foo/2.txt'], function(err, rsp){
if(err){ return cb(err); }
return cb(null, rsp.Success)
});
});
}
This method allows you to upload a file to Contensis, It will overwrite existing files. Most file types are supported other than complex non file like content such as Forms, Templates and Databases.
FAQs
Allows you to Query Contensis with relevant credentials in order to sync files
We found that contensis-sync-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.