Skip to content

Commit 807044f

Browse files
committed
Run prettier on README
1 parent ba51881 commit 807044f

1 file changed

Lines changed: 29 additions & 25 deletions

File tree

README.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# cloudconvert-node
22

3-
4-
> This is the official Node.js SDK v2 for the [CloudConvert](https://cloudconvert.com/api/v2) _API v2_.
3+
> This is the official Node.js SDK v2 for the [CloudConvert](https://cloudconvert.com/api/v2) _API v2_.
54
> For API v1, please use [v1 branch](https://github.com/cloudconvert/cloudconvert-node/tree/v1) of this repository.
65
76
[![Build Status](https://travis-ci.org/cloudconvert/cloudconvert-node.svg?branch=master)](https://travis-ci.org/cloudconvert/cloudconvert-node)
@@ -10,21 +9,20 @@
109

1110
## Installation
1211

13-
1412
npm install --save cloudconvert
15-
13+
1614
Load as ESM module:
1715

1816
```js
1917
import CloudConvert from 'cloudconvert';
2018
```
2119

2220
... or via require:
21+
2322
```js
2423
const CloudConvert = require('cloudconvert');
2524
```
2625

27-
2826
## Creating Jobs
2927

3028
```js
@@ -33,24 +31,25 @@ import CloudConvert from 'cloudconvert';
3331
const cloudConvert = new CloudConvert('api_key');
3432

3533
let job = await cloudConvert.jobs.create({
36-
'tasks': {
34+
tasks: {
3735
'import-my-file': {
38-
'operation': 'import/url',
39-
'url': 'https://my-url'
36+
operation: 'import/url',
37+
url: 'https://my-url'
4038
},
4139
'convert-my-file': {
42-
'operation': 'convert',
43-
'input': 'import-my-file',
44-
'output_format': 'pdf',
45-
'some_other_option': 'value'
40+
operation: 'convert',
41+
input: 'import-my-file',
42+
output_format: 'pdf',
43+
some_other_option: 'value'
4644
},
4745
'export-my-file': {
48-
'operation': 'export/url',
49-
'input': 'convert-my-file'
46+
operation: 'export/url',
47+
input: 'convert-my-file'
5048
}
5149
}
5250
});
5351
```
52+
5453
You can use the [CloudConvert Job Builder](https://cloudconvert.com/api/v2/jobs/builder) to see the available options for the various task types.
5554

5655
## Downloading Files
@@ -60,13 +59,15 @@ CloudConvert can generate public URLs for using `export/url` tasks. You can use
6059
```js
6160
job = await cloudConvert.jobs.wait(job.id); // Wait for job completion
6261

63-
const exportTask = job.tasks.filter(task => task.operation === 'export/url' && task.status === 'finished')[0];
62+
const exportTask = job.tasks.filter(
63+
task => task.operation === 'export/url' && task.status === 'finished'
64+
)[0];
6465
const file = exportTask.result.files[0];
6566

6667
const writeStream = fs.createWriteStream('./out/' + file.filename);
6768

68-
https.get(file.url, function(response) {
69-
response.pipe(writeStream);
69+
https.get(file.url, function (response) {
70+
response.pipe(writeStream);
7071
});
7172

7273
await new Promise((resolve, reject) => {
@@ -81,10 +82,10 @@ Uploads to CloudConvert are done via `import/upload` tasks (see the [docs](https
8182

8283
```js
8384
const job = await cloudConvert.jobs.create({
84-
'tasks': {
85+
tasks: {
8586
'upload-my-file': {
86-
'operation': 'import/upload'
87-
},
87+
operation: 'import/upload'
88+
}
8889
// ...
8990
}
9091
});
@@ -96,12 +97,10 @@ const inputFile = fs.createReadStream('./file.pdf');
9697
await cloudConvert.tasks.upload(uploadTask, inputFile);
9798
```
9899

99-
100100
## Websocket Events
101101

102102
The node SDK can subscribe to events of the [CloudConvert socket.io API](https://cloudconvert.com/api/v2/socket#socket).
103103

104-
105104
```js
106105
const job = await cloudConvert.jobs.create({ ... });
107106

@@ -121,6 +120,7 @@ cloudConvert.jobs.subscribeTaskEvent(job.id, 'finished', event => {
121120
```
122121

123122
When you don't want to receive any events any more you should close the socket:
123+
124124
```js
125125
cloudConvert.socket.close();
126126
```
@@ -134,7 +134,11 @@ const payloadString = '...'; // The JSON string from the raw request body.
134134
const signature = '...'; // The value of the "CloudConvert-Signature" header.
135135
const signingSecret = '...'; // You can find it in your webhook settings.
136136

137-
const isValid = cloudConvert.webhooks.verify(payloadString, signature, signingSecret); // returns true or false
137+
const isValid = cloudConvert.webhooks.verify(
138+
payloadString,
139+
signature,
140+
signingSecret
141+
); // returns true or false
138142
```
139143

140144
## Contributing
@@ -174,5 +178,5 @@ By default, this runs the integration tests against the Sandbox API with an offi
174178

175179
## Resources
176180

177-
* [API v2 Documentation](https://cloudconvert.com/api/v2)
178-
* [CloudConvert Blog](https://cloudconvert.com/blog)
181+
- [API v2 Documentation](https://cloudconvert.com/api/v2)
182+
- [CloudConvert Blog](https://cloudconvert.com/blog)

0 commit comments

Comments
 (0)