
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@nutrient-sdk/dws-client-typescript
Advanced tools
Node.js TypeScript client library for Nutrient Document Web Services (DWS) API
A Node.js TypeScript client library for Nutrient Document Web Services (DWS) API. This library provides a type-safe and ergonomic interface for document processing operations including conversion, merging, compression, watermarking, and text extraction.
Note: This package is published as
@nutrient-sdk/dws-client-typescript
on NPM. The package provides full TypeScript support and is designed specifically for Node.js environments.
npm install @nutrient-sdk/dws-client-typescript
or
yarn add @nutrient-sdk/dws-client-typescript
This package has built-in support with popular coding agents like Claude Code, GitHub Copilot, Cursor, and Windsurf by exposing scripts that will inject rules instructing the coding agents on how to use the package. This ensures that the coding agent doesn't hallucinate documentation, as well as making full use of all the features offered in Nutrient DWS TypeScript Client.
# Adding code rule to Claude Code
npx dws-add-claude-code-rule
# Adding code rule to GitHub Copilot
npx dws-add-github-copilot-rule
# Adding code rule to Junie (Jetbrains)
npx dws-add-junie-rule
# Adding code rule to Cursor
npx dws-add-cursor-rule
# Adding code rule to Windsurf
npx dws-add-windsurf-rule
The documentation for Nutrient DWS TypeScript Client is also available on Context7
const client = new NutrientClient({
apiKey: 'nutr_sk_your_secret_key'
});
The client provides numerous methods for document processing:
// Convert a document
const pdfResult = await client.convert('document.docx', 'pdf');
// Extract text
const textResult = await client.extractText('document.pdf');
// Add a watermark
const watermarkedDoc = await client.watermarkText('document.pdf', 'CONFIDENTIAL');
// Merge multiple documents
const mergedPdf = await client.merge(['doc1.pdf', 'doc2.pdf', 'doc3.pdf']);
For a complete list of available methods with examples, see the Methods Documentation.
The client also provide a fluent builder pattern with staged interfaces to create document processing workflows:
const result = await client
.workflow()
.addFilePart('document.pdf')
.addFilePart('appendix.pdf')
.applyAction(BuildActions.watermarkText('CONFIDENTIAL', {
opacity: 0.5,
fontSize: 48
}))
.outputPdf({
optimize: {
mrcCompression: true,
imageOptimizationQuality: 2
}
})
.execute();
The workflow system follows a staged approach:
For detailed information about the workflow system, including examples and best practices, see the Workflow Documentation.
The library provides a comprehensive error hierarchy:
import {
NutrientError,
ValidationError,
APIError,
AuthenticationError,
NetworkError
} from '@nutrient-sdk/dws-client-typescript';
try {
const result = await client.convert('file.docx', 'pdf');
} catch (error) {
if (error instanceof ValidationError) {
// Invalid input parameters
console.error('Invalid input:', error.message, error.details);
} else if (error instanceof AuthenticationError) {
// Authentication failed
console.error('Auth error:', error.message, error.statusCode);
} else if (error instanceof APIError) {
// API returned an error
console.error('API error:', error.message, error.statusCode, error.details);
} else if (error instanceof NetworkError) {
// Network request failed
console.error('Network error:', error.message, error.details);
}
}
The library includes comprehensive unit and integration tests:
# Run all tests
npm test
# Run with coverage report
npm test -- --coverage
# Run only unit tests
npm run test:unit
# Run integration tests (requires API key)
NUTRIENT_API_KEY=your_key npm run test:integration
The library maintains high test coverage across all API methods, including:
We welcome contributions to improve the library! Please follow our development standards to ensure code quality and maintainability.
Quick start for contributors:
For detailed contribution guidelines, see the Contributing Guide.
src/
├── __tests__/ # Test files
├── builders/ # Builder classes
├── generated/ # Generated code
├── types/ # TypeScript interfaces and types
├── build.ts # Build utilities
├── client.ts # Main NutrientClient class
├── errors.ts # Error classes
├── http.ts # HTTP layer
├── inputs.ts # Input handling
├── workflow.ts # WorkflowBuilder class
└── index.ts # Public exports
This project uses GitHub Actions for continuous integration and deployment:
For security reasons, API keys are stored as GitHub Secrets and Integration tests only run on trusted sources.
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and feature requests, please use the GitHub issue tracker.
For questions about the Nutrient DWS Processor API, refer to the official documentation.
FAQs
Node.js TypeScript client library for Nutrient Document Web Services (DWS) API
We found that @nutrient-sdk/dws-client-typescript demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.