Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3720cf0
update deps
KnorpelSenf Feb 5, 2024
63c86a8
update tooling and config
KnorpelSenf Feb 5, 2024
6405d34
drop axios, use web fetch
KnorpelSenf Feb 6, 2024
e7333ea
chore: set prettier as the default formatter
KnorpelSenf Feb 19, 2024
ea8685a
build: require Node 19
KnorpelSenf Feb 19, 2024
b3a03c2
format markdown with prettier, too
KnorpelSenf Feb 19, 2024
a804d45
move to blobs
KnorpelSenf Feb 19, 2024
7423f5d
build: require Node 20
KnorpelSenf Apr 16, 2025
0d9e529
build: update deps again
KnorpelSenf Apr 16, 2025
a8c1a65
style: reformat README
KnorpelSenf Apr 16, 2025
0d7b31a
style: reformat tsconfig
KnorpelSenf Apr 16, 2025
39144ac
fix: update usage of fetch and socket.io
KnorpelSenf Apr 16, 2025
e58a9aa
test: migrate tests to TS
KnorpelSenf Apr 16, 2025
621db1d
build: use minimal supported Node types
KnorpelSenf Apr 16, 2025
2a75f8b
feat: support many types of files
KnorpelSenf Apr 16, 2025
1748a08
docs: revert temporary changes to file input source support
KnorpelSenf Apr 16, 2025
944509a
Merge branch 'master' into maintenance
KnorpelSenf Apr 16, 2025
e9c860e
chore: migrate ESLint config
KnorpelSenf Apr 16, 2025
9db8344
chore: change Node versions in CI
KnorpelSenf Apr 16, 2025
463943d
chore: do not use Node 24 yet
KnorpelSenf Apr 16, 2025
766a814
test: migrate e2e tests away from axios
KnorpelSenf Apr 16, 2025
7d62e97
fix: throw better errors
KnorpelSenf Apr 16, 2025
e78c0c4
feat: add temporary logging
KnorpelSenf Apr 19, 2025
f2d3a42
refactor: remove bad return types
KnorpelSenf Apr 20, 2025
b8b5cfa
fix: support S3 uploads in client
KnorpelSenf Apr 20, 2025
04de11b
test: remove temporary logging
KnorpelSenf Apr 20, 2025
c4f9f07
docs: prefer find over filter
KnorpelSenf Apr 20, 2025
e5e0b99
refactor: make import more specific
KnorpelSenf Apr 20, 2025
6b7fed2
feat: re-introduce fileSize parameter, set Content-Length
KnorpelSenf Apr 23, 2025
aa59cf0
fix: precompute total body size
KnorpelSenf Apr 23, 2025
aad2dea
add mocharc.json
josiasmontag Apr 23, 2025
181e262
test with node v23
josiasmontag Apr 23, 2025
8e3c4b0
update README
josiasmontag Apr 23, 2025
9e299d7
limit parallel tests to avoid rate limits
josiasmontag Apr 23, 2025
02857a2
fix race condition in tests
josiasmontag Apr 23, 2025
a55e11a
upload(): do not read file size of provided filename
josiasmontag Apr 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .eslintrc.js

This file was deleted.

42 changes: 21 additions & 21 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
name: Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
build:
runs-on: ubuntu-latest

runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
node-version: [20, 22, 23]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

strategy:
matrix:
node-version: [16, 18, 20]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install -d
- run: npm run lint
- run: npm test
- run: npm run test-integration
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install -d
- run: npm run lint
- run: npm test
- run: npm run test-integration
6 changes: 6 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"require": "tsx",
"spec": [
"tests/**/*.ts"
]
}
2 changes: 0 additions & 2 deletions .eslintignore → .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.DS_Store
.idea
node_modules/
built/
package-lock.json
Expand Down
14 changes: 7 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"singleQuote": true,
"trailingComma": "none",
"htmlWhitespaceSensitivity": "ignore",
"tabWidth": 4,
"semi": true,
"arrowParens": "avoid"
}
"singleQuote": true,
"trailingComma": "none",
"htmlWhitespaceSensitivity": "ignore",
"tabWidth": 4,
"semi": true,
"arrowParens": "avoid"
}
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"[md]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cloudconvert-node

This is the official Node.js SDK v2 for the [CloudConvert](https://cloudconvert.com/api/v2) **API v2**.
This is the official Node.js SDK for the [CloudConvert](https://cloudconvert.com/api/v2) API v2.

[![Node.js Run Tests](https://github.com/cloudconvert/cloudconvert-node/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cloudconvert/cloudconvert-node/actions/workflows/run-tests.yml)
[![npm](https://img.shields.io/npm/v/cloudconvert.svg)](https://www.npmjs.com/package/cloudconvert)
Expand Down Expand Up @@ -86,15 +86,15 @@ const job = await cloudConvert.jobs.create({
}
});

const uploadTask = job.tasks.filter(task => task.name === 'upload-my-file')[0];
const uploadTask = job.tasks.find(task => task.name === 'upload-my-file');

const inputFile = fs.createReadStream('./file.pdf');

await cloudConvert.tasks.upload(uploadTask, inputFile, 'file.pdf');
```
> **Note on custom streams**:
The length of the stream needs to be known prior to uploading. The SDK automatically detects the file size of file-based read streams. If you are using a custom stream, you need to pass a `filesize` as fourth parameter to the `upload()` method.

> **Note on custom streams**:
The length of the stream needs to be known prior to uploading. The SDK tries to automatically detect the file size of file-based read streams. If you are using a custom stream, you might need to pass a `fileSize` as fourth parameter to the `upload()` method.

## Websocket Events

Expand Down Expand Up @@ -242,5 +242,5 @@ and even auto-fix as many things as possible by running

## Resources

- [API v2 Documentation](https://cloudconvert.com/api/v2)
- [CloudConvert Blog](https://cloudconvert.com/blog)
- [API v2 Documentation](https://cloudconvert.com/api/v2)
- [CloudConvert Blog](https://cloudconvert.com/blog)
55 changes: 55 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { defineConfig, globalIgnores } from 'eslint/config';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default defineConfig([
globalIgnores([
'**/node_modules/',
'**/built/',
'**/package-lock.json',
'**/package.json',
'tests/unit/requests/',
'tests/unit/responses/',
'.vscode/',
'tsconfig.json',
'.mocharc.json'
]),
{
extends: compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
),

plugins: {
'@typescript-eslint': typescriptEslint
},

languageOptions: {
globals: {
...globals.browser,
...globals.node
},

parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module'
},

rules: {
'@typescript-eslint/no-explicit-any': 'off'
}
}
]);
Loading