Nunjucks Powers Mozilla
Introducing npm Teams! Private packages + team management tools.Learn more »

plagiarism-checker

1.2.1 • Public • Published

Copyleaks NodeJs SDK

Copyleaks SDK enables you to scan text for plagiarism and detect content distribution online, using the Copyleaks plagiarism checker API.

Using Copyleaks SDK you can check for plagiarism in:

Integration

Integrate with the Copyleaks SDK in one of two options:

  • Recommended: Use the Package Manager - NPM.
    When integrating that way you will automatically be able to update the SDK to its latest version:
    npm i plagiarism-checker
    
    Following that, in order to use the SDK, add this to your code:
    var CopyleaksCloud = require('plagiarism-checker');
    var clCloud = new CopyleaksCloud();
    var config = clCloud.getConfig();
    
  • Download the code from this repository and add it to your project.

In any case, make sure you have the following dependencies installed:

$ npm install lodash
$ npm install request
$ npm install request-promise
$ npm install mime-types

Register and Get Your API Key

To use the Copyleaks API you need to first be a registered user. The registration to Copyleaks takes a minute and is free of charge. Signup and make sure to confirm your account.

As a signed user you can generate your personal API key. Do so on your dashboard (Businesses dashboard/Academic dashboard/Websites dashboard) under 'Access Keys'.

For more information check out our API guide.

Example

See example_async.js for an example using callbacks.

Usage

Set your credentials:

var email = 'YOUR-EMAIL';
var apikey = 'YOUR-API-KEY';

Set custom headers for the process:

var _customHeaders = {};
_customHeaders[config.SANDBOX_MODE_HEADER] = true; // Sandbox mode - Scan without consuming any credits and get back dummy results
_customHeaders[config.HTTP_CALLBACK] = 'http://your.website.com/callbacks/' // Callback url - For a fast testing of callbacks option we recommend to use http://requestb.in

Create a process using createByUrl method:

clCloud.createByURL(url,_customHeaders,function(resp,err){
	if(resp && resp.ProcessId){
		console.log('API: create-by-url');
		console.log('Process has been created: '+resp.ProcessId);
	}
}); 

Available create methods are: createByURL, createByFile, createByFiles, createByOCR and createByText.

Configuration

You can set aditional headers and add them to your process:

var _customHeaders = {};
_customHeaders[config.SANDBOX_MODE_HEADER] = true;
_customHeaders[config.HTTP_CALLBACK] = 'http://your.website.com/callbacks/'
_customHeaders[config.IN_PROGRESS_RESULT] = 'http://your.website.com/callback/results/'
_customHeaders[config.EMAIL_CALLBACK] = 'myemail@company.com'
_customHeaders[config.PARTIAL_SCAN_HEADER] = true;
_customHeaders[config.COMPARE_ONLY] = true; // Compare files in between - available only on createByFiles
_customHeaders[config.IMPORT_FILE_TO_DATABASE] = true; // Import your file to our database only

For more info about the optional headers see API Request Headers

For more info about the optional headers visit https://api.copyleaks.com/documentation/headers

Read More

Keywords

none

Install

npm i plagiarism-checker

DownloadsWeekly Downloads

6

Version

1.2.1

License

MIT

Unpacked Size

24.9 kB

Total Files

7

Last publish

Collaborators

  • avatar