Node module for accessing the Crowdin API
This is an unofficial API client library. Crowdin and the Crowdin API are the property of Crowdin, LLC.
npm install crowdin
apiKey
and endpointUrl
parameters must be set to create the instance, an error will be thrown otherwise.
var crowdin = new Crowdin({
apiKey: '7d38782fa7cb4b6a9fbae2de65e91989',
endpointUrl: 'https://api.crowdin.net/api/project/<your-project>'
});
And, in this fork, in order to handle the crowdin branchs, optionally is possible to set a branch
parameter,
var crowdin = new Crowdin({
apiKey: '7d38782fa7cb4b6a9fbae2de65e91989',
endpointUrl: 'https://api.crowdin.net/api/project/<your-project>',
branch: 'branch-name'
});
to add the branch parameter to the real background crowdin api requests:
GET https://api.crowdin.com/api/project/{project-identifier}
/export?key={project-key}&branch={branch-name}
GET https://api.crowdin.com/api/project/{project-identifier}
/download/{package}.zip?key={project-key}&branch={branch-name}
Returns a Promise of a call to the API endpoint with specified parameters.
Parses the response body and rejects if the API returns an error.
Returns a Promise of a GET request to the set API endpoint. Uses requestData()
.
Returns a Promise of a POST request to the set API endpoint. Uses requestData()
.
Returns a Promise of project information. Uses postRequest()
.
Returns a Promise of project languages. Uses getInfo()
.
Returns a Promise of an API call to the export
endpoint. Uses getRequest()
.
Downloads the translations ZIP and returns the Stream.
You might call export()
before to ensure you have the latest translations.
Downloads the translations ZIP to the specified stream. Uses download()
and returns an empty Promise.
Downloads the translations ZIP to the specified path. Uses download()
and returns an empty Promise.
Downloads and extracts the translations ZIP to the specified path. Uses download()
and returns an empty Promise.
Downloads and parses the translations ZIP. Uses download()
and returns the Stream of file entries.
See the node-unzip documentation.
Downloads, extracts and converts the translations ZIP to a JS object. Returns a Promise.
Tests are written with mocha
npm test
Coverage using istanbul
npm run coverage
Apache 2.0
Copyright 2015 Hailo