package
Jodit FileBrowser and Uploader connector for Node.js
npm install jodit-nodejsGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Node.js/TypeScript implementation of the Jodit File Browser and Uploader connector.
Links:
npm install jodit-nodejsimport { start } from 'jodit-nodejs';
// Start server with default config
const server = await start(8081);
console.log('Server running on http://localhost:8081');const { start } = require('jodit-nodejs');
async function main() {
const server = await start(8081);
console.log('Server running on http://localhost:8081');
}
main().catch(console.error);import { start } from 'jodit-nodejs';
await start({
port: 8081,
config: {
debug: false,
allowCrossOrigin: true,
sources: {
uploads: {
name: 'uploads',
title: 'User Uploads',
root: '/var/www/uploads',
// NGINX or CDN base URL for accessing files
baseurl: 'http://localhost:8080/uploads/'
}
}
}
});import { start, type AuthCallback } from 'jodit-nodejs';
const checkAuth: AuthCallback = async (req) => {
const token = req.headers.authorization;
if (!token) return 'guest';
const user = await validateToken(token);
return user.role; // 'admin', 'editor', 'guest', etc.
};
await start({
port: 8081,
config: {
defaultRole: 'guest',
accessControl: [
{ role: 'guest', FILES: true, FILE_UPLOAD: false },
{ role: 'admin', FILES: true, FILE_UPLOAD: true }
]
},
checkAuthentication: checkAuth
});import { start } from 'jodit-nodejs';
await start({
port: 8081,
config: {
sources: {
media: {
name: 'media',
title: 'Media',
baseurl: 'https://my-bucket.s3.eu-central-1.amazonaws.com/media/',
storageAdapter: 's3',
s3: { bucket: 'my-bucket', region: 'eu-central-1', prefix: 'media' }
}
}
}
});Credentials come from the AWS default chain (AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY, profiles, instance roles) unless s3.credentials is set. MinIO, Cloudflare R2, Yandex Object Storage and other S3-compatible services work with endpoint (and forcePathStyle where needed). See the S3 guide.
You can restrict the API to accept only POST requests:
import { start } from 'jodit-nodejs';
await start({
port: 8081,
config: {
onlyPOST: true, // Block all GET requests
sources: {
uploads: {
name: 'uploads',
title: 'User Uploads',
root: '/var/www/uploads',
baseurl: 'http://localhost:8080/uploads/'
}
}
}
});When onlyPOST is enabled, all GET requests return 405 Method Not Allowed. This protects against GET-based CSRF attacks and keeps request parameters out of web server access logs.
Complete Documentation - Full documentation with guides and API reference
Quick Links:
OpenAPI Specification:
Check the examples/ directory for complete working examples:
examples/basic-js.js - Simple server setupexamples/with-auth-js.js - With authentication callbackexamples/with-cookie-auth.js - Cookie-based authenticationexamples/with-jwt-auth.js - JWT token authenticationexamples/with-express-session.js - Express-session integrationnpm run dev # Development with hot reload
npm run build # Compile TypeScript
npm start # Run compiled application
npm test # Run tests
npm run lint # Check code quality# Build and run
docker build -t jodit-nodejs .
docker run --rm -p 8081:8081 jodit-nodejs
# With custom config
docker run --rm -p 8081:8081 \
-v /host/path/to/config.json:/usr/src/app/config.json \
-v /host/path/to/files:/usr/src/app/files \
jodit-nodejs
# Against an S3 bucket (see config.s3.example.json)
docker run --rm -p 8081:8081 \
-e AWS_ACCESS_KEY_ID=... -e AWS_SECRET_ACCESS_KEY=... \
-v $(pwd)/config.s3.example.json:/usr/src/app/config.json \
jodit-nodejsMIT
Estimated unpacked size across 64 packages.
25.8 MB+
Includes dependencies.
^5.1.0
5.3.0
^1.6.6
1.6.9
^3.18.3
3.19.0
^4.3.1
4.3.1
^24.25.0
25.17.0
^10.0.1
10.0.1
^7.0.0
7.0.3
^3.0.2
3.0.2
^5.4.4
5.4.4
^1.6.3
1.6.5
^3.1134.0
3.1169.0
^3.1134.0
3.1169.0
^1.2.0
1.2.0
^1.2.0
1.2.0
^1.16.0
1.23.3
^1.2.0
1.2.2
9.1.0